You are previewing Git Best Practices Guide.
O'Reilly logo
Git Best Practices Guide

Book Description

Master the best practices of Git with the help of real-time scenarios to maximize team efficiency and workflow

In Detail

Git is a powerful versioning system. It is fast and logical, and helps developers to work with a team efficiently. The command set and learning curve of Git are pretty similar to and even better than any other SCM, and therefore it is comparatively easier to learn.

Starting with the basic Git commands, this book will take you on a journey to explore all the features of Git and provide you with a way to integrate Git in a team to set up Agile methods and Continuous Integration.

The book covers how to create and manage a repository on Git before moving on to explain the best practices to work with other developers as a team. It provides descriptions of Git's features, such as applying patch, using submodules, migrating from SVN, hooks, and cherry pick.

This book is invaluable to anyone who wants a thorough reference guide to go back to every time they have questions about any feature of Git.

What You Will Learn

  • Create a Git repository and learn how to push your code to the repository
  • Discover the easiest Git commands to use and manage your repository
  • Learn how to find and resolve conflicts and mistakes
  • Explore Git with your team members using commands such as clone, pull, and branch
  • Set up Git for Continuous Integration to improve workflow
  • Understand tag commits for mapping the application version
  • An introduction to repository management and other Git tools
  • Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

    Table of Contents

    1. Git Best Practices Guide
      1. Table of Contents
      2. Git Best Practices Guide
      3. Credits
      4. About the Author
      5. About the Reviewers
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Errata
          2. Piracy
          3. Questions
      8. 1. Starting a Git Repository
        1. Configuring Git
        2. Initializing a new repository
        3. Cloning an existent repository
        4. Working with the repository
          1. Adding a file
          2. Committing a file
          3. Pushing a file
          4. Removing a file
          5. Checking the status
          6. Ignoring files
        5. Summary
      9. 2. Working in a Team Using Git
        1. Creating a server repository
          1. Local
          2. SSH
          3. Git
          4. HTTPS
        2. Pushing data on remote repositories – Jim's case
        3. Pulling data from the repository
        4. Creating a patch
        5. Working with branches
          1. Creating a branch
          2. Checking out a branch
          3. Playing with a branch
          4. The difference between branches
        6. Tracking branches
          1. Deleting a branch from the remote
        7. Merging
          1. Fast forward merge
          2. Merge commit
          3. Other merging strategies
        8. Rebase
        9. Cherry-pick
        10. Using tags
          1. Creating and deleting tags
        11. Summary
      10. 3. Finding and Resolving Conflicts
        1. Finding content inside your repository
          1. Searching file content
          2. Showing the current status
          3. Exploring the repository history
          4. Viewing changes
        2. Stashing your changes
        3. Cleaning your mistakes
          1. Reverting uncommitted changes
          2. The git reset command
          3. Editing a commit
          4. Canceling a commit
          5. Rewriting commit history
          6. Solving merge conflicts
          7. Searching errors with git bisect
        4. Fixing errors by practical examples
        5. Summary
      11. 4. Going Deeper into Git
        1. Migrating an SVN repository to Git
          1. Preparing for SVN to Git migration
          2. Migrating from SVN to Git
          3. Cleaning your commits
          4. Pushing content on Git
          5. Migrating branches and tags
          6. Another easy way to migrate
        2. Using Git within an SVN environment
          1. Setting up your repository
          2. Working with Git SVN
        3. Managing Git submodules
          1. Adding a submodule
          2. Cloning a project with submodules
          3. Removing a submodule
          4. Using a subtree instead of a submodule
            1. Adding a subproject with a subtree
            2. Contributing on a subtree
        4. Creating and applying patches
          1. Creating a patch
          2. Mailing the patch
          3. Applying the patch
        5. Git hooks
          1. Client hooks
          2. Server hooks
          3. More about hooks
          4. Installing a hook
            1. A hook example
        6. Customizing Git
        7. Summary
      12. 5. Using Git for Continuous Integration
        1. Creating an efficient branching system
          1. Git flow
            1. Feature branches
            2. Release branches
            3. Hotfix branches
          2. BPF – Branch Per Feature
        2. Working with Continuous Integration using Git
        3. Git tools you might like
          1. Git GUI clients
            1. On Linux
            2. On Windows
            3. On Mac
          2. Repository management
        4. Summary
      13. Index