Git Recipes: A Problem-Solution Approach

Book description

Whether you're relatively new to git or you need a refresher, or if you just need a quick, handy reference for common tasks in git, Git Recipes is just the reference book you need.

With recipes to cover any task you can think of, including working with GitHub and git on BitBucket, Git Recipes shows you how to work with large repositories, new repositories, forks, clones, conflicts, differences, and it even gives you practical scenarios you may find yourself dealing with while using git.

If you work with Git at all, you need this hands-on, practical reference for all things Git.

What you'll learn

  • How to work with both well-known and local repositories

  • How to deal with issues like dangling revisions and disjointed branches

  • How to pinpoint who made specific changes

  • How to deal with textual and binary conflicts

  • How to work with hosted solutions like GitHub and BitBucket

  • How to work with git in large groups

  • Who this book is for

    People who need a quick, practical reference for everything related to Git.

    Table of contents

    1. Title Page
    2. Dedication
    3. Contents at a Glance
    4. Contents
    5. About the Author
    6. About the Technical Reviewer
    7. Acknowledgments
    8. CHAPTER 1: Getting Started with Git
      1. What is git?
      2. 1-1. Installing git on Windows
      3. 1-2. Installing git on Linux
      4. 1-3. Installing git on OS X
      5. 1-4. Accessing the manual
      6. 1-5. Configuring git
    9. CHAPTER 2: Working with Well-Known Repositories
      1. 2-1. Cloning a repository hosted on Github
      2. 2-2. Cloning a repository hosted on Bitbucket
      3. 2-3. Cloning a local repository
      4. 2-4. Copying a local repository
      5. 2-5. Exploring the contents of a git repository
      6. 2-6. Deleting and restoring the contents of the working directory
      7. 2-7. Cloning a bare repository
      8. 2-8. Exploring the history with a git log command
      9. 2-9. Analyzing a repository with git log and shortlog commands
      10. 2-10. Defining aliases for the commands discussed in Recipes 2-8 and 2-9
      11. 2-11. Analyzing one of the popular repositories
      12. 2-12. Visualizing the history of a repository
      13. 2-13. Removing a .git directory
      14. Summary
    10. CHAPTER 3: Creating Local Repositories with Linear History
      1. 3-1. Creating your first repository
      2. 3-2. Creating the git snapshot alias
      3. 3-3. Using the git snapshot alias in your daily work
      4. 3-4. Mapping names
      5. 3-5. Restoring revisions with git reset
      6. 3-6. Restoring revisions with git checkout
      7. 3-7. Creating a git s alias
      8. 3-8. Working with reflog
      9. 3-9. Creating a new repository in an existing project
      10. 3-10. Losing uncommitted changes
      11. 3-11. Creating a git simple-commit alias
      12. 3-12. Loosing commits
      13. Summary
    11. CHAPTER 4: Managing Files
      1. 4-1. Staging and committing a new file
      2. 4-2. Staging and committing a modified file
      3. 4-3. Committing a modified file
      4. 4-4. Staging and committing a removed file
      5. 4-5. Committing a file removed with the standard rm command
      6. 4-6. Converting an unmodified file into an untracked file
      7. 4-7. Staging and committing a file renamed with git mv
      8. 4-8. Committing a file renamed with the standard mv command
      9. 4-9. Staging all files
      10. 4-10. Working with mixed states
      11. Summary
    12. CHAPTER 5: Branches
      1. 5-1. Creating and switching branches
      2. 5-2. Cloning a repository with branches
      3. 5-3. Creating a clone-with-branches alias
      4. 5-4. Committing in a detached HEAD state
      5. 5-5. Resetting and cleaning a branch
      6. 5-6. Switching branches in a dirty repository without conflicts
      7. 5-7. Switching branches in a dirty repository with conflicts
      8. 5-8. Committing in a wrong branch
      9. 5-9. Deleting local branches
      10. 5-10. Using a branch as a backup
      11. 5-11. Renaming branches
      12. 5-12. Checking out a file from a different branch
      13. 5-13. Switching branches in a bare repository
      14. Summary
    13. CHAPTER 6: Merging Branches
      1. 6-1. Implementing a new feature in a branch
      2. 6-2. Fast-forwarding branches
      3. 6-3. Undoing fast-forward
      4. 6-4. Developing in parallel diverged branches
      5. 6-5. Merging diverged branches
      6. 6-6. Avoiding a fast-forward merge
      7. 6-7. Diverging multiple branches
      8. 6-8. Merging multiple branches
      9. Summary
    14. CHAPTER 7: Rebasing Branches
      1. 7-1. Rebasing divergent branches
      2. 7-2. Manually rebasing divergent branches
      3. 7-3. Joining divergent branches into linear history
      4. 7-4. Diverging three branches
      5. 7-5. Partial rebasing
      6. 7-6. Creating bulbs for divergent branches
      7. 7-7. Creating bulbs in subbranches
      8. 7-8. Rebasing branches with bulbs
      9. 7-9. Preserving merges during rebase
      10. Summary
    15. CHAPTER 8: Modifying the History
      1. 8-1. Amending the most recent revision
      2. 8-2. Removing n most recent revisions
      3. 8-3. Squashing many revisions into one revision
      4. 8-4. Splitting one revision into many revisions
      5. 8-5. Reordering revisions
      6. 8-6. Removing several revisions
      7. 8-7. Editing an old revision
      8. 8-8. Reverting revisions
      9. 8-9. Reverting merge commit revisions
      10. 8-10. Cherry-picking revisions
      11. 8-11. Squashing a branch
      12. 8-12. Re-using a reverted branch
      13. Summary
    16. CHAPTER 9: Resolving Conflicts
      1. 9-1. Creating conflicting changes in text files
      2. 9-2. Resolving textual conflict after merging
      3. 9-3. Resolving textual conflict after rebasing
      4. 9-4 Creating conflicting changes in binary files
      5. 9-5. Resolving a binary conflict during merging
      6. 9-6. Resolving a binary conflict during rebasing
      7. 9-7. Forcing a binary mode during merge
      8. Summary
    17. CHAPTER 10: Remote Repositories and Synchronization
      1. 10-1. Manual cloning
      2. 10-2. Coworking with a central repository
      3. 10-3. Generating (n-1) merge commits for one commit
      4. 10-4. Keeping the history linear
      5. 10-5. Coworking without a central repository
      6. 10-6. Working with remote branches
      7. 10-7. Using remote branches for contributions
      8. 10-8. Accepting contributions
      9. 10-9. Appending commits to a remote branch
      10. 10-10. Rewriting history with $ git push -f
      11. 10-11. Finishing the work on the remote branch
      12. 10-12. Pushing to non-bare repositories
      13. Summary
    18. CHAPTER 11: Hosting git Git Repositories
      1. 11-1. Installing VirtualBox and Vagrant
      2. 11-2. Running virtual Linux
      3. 11-3. Compiling git on a virtual machine
      4. 11-4. Hosting git repositories over ssh
      5. 11-5. Simplifying ssh authorization with authorized_keys
      6. 11-6. Hosting git repositories with git daemon
      7. 11-7. Hosting git repositories over http
      8. 11-8. Using Gitweb CGI application
      9. 11-9. Using a cgit CGI application
      10. 11-10. Working with gitolite
      11. Summary
    19. CHAPTER 12: Working with Github.com
      1. 12-1. Creating a Github account
      2. 12-2. Configuring a Github account with SSH keys
      3. 12-3. Creating a Github-hosted repository for a new project
      4. 12-4. Creating a Github-hosted repository for an existing project
      5. 12-5. Creating an organization account on Github
      6. 12-6. Creating a new project hosted by an organization
      7. 12-7. Sending pull requests
      8. 12-8. Reworking your pull requests
      9. 12-9. Accepting a pull request
      10. How It Works
      11. Summary
    20. CHAPTER 13: More Recipes
      1. 13-1. Working with the $ git diff command
      2. 13-2. Committing files without line-ending conversion
      3. 13-3. Checking out files without line-ending conversion
      4. 13-4. Converting line endings to CRLF in the working directory during checkout and committing the change
      5. 13-5. Converting line endings to LF and committing the change
      6. 13-6. Unintended conversion of all line endings
      7. 13-7. Defining line endings for individual files and directories
      8. 13-8. Ignoring automatically generated files
      9. 13-9. Customizing a project with .dist files
      10. 13-10. Using the .git/info/exclude file
      11. 13-11. Using tags
      12. 13-12. Exporting repositories to zipped archives
      13. Summary
    21. Index

    Product information

    • Title: Git Recipes: A Problem-Solution Approach
    • Author(s): Włodzimierz Gajda
    • Release date: December 2013
    • Publisher(s): Apress
    • ISBN: 9781430261032