What will you learn from this book?

Many people who use Git rely on "recipes"—basic copy-paste commands—without understanding how this version control system actually works. But what do you do if you find yourself in a tight spot? You can't simply wing it. With this unique hands-on guide, you'll learn valuable ways to use Git in many different situations. Raju Gandhi peels back the layers to reveal the simple yet powerful engine that powers Git, with activities that help you truly understand this crucial tool as you get it up and running. You’ll master branches, tags, stashes, and merges; learn best practices; collaborate with your team; and unlock the full potential of Git.

What’s so special about this book?

If you've read a Head First book, you know what to expect—a visually rich format designed for the way your brain works. If you haven't, you're in for a treat. With this book, you’ll learn Git through a multi-sensory experience that engages your mind, rather than a text-heavy approach that puts you to sleep

Table of Contents

  1. 1. Beginning Git: Get going with Git
    1. Why we need version control
    2. Cubicle Conversation
    3. Start your engines ...
    4. A quick tour of the command line
    5. More on the command line (mkdir)
    6. More on the command line (ls)
    7. More on the command line (cd)
    8. No argument there
    9. Cleaning up
    10. Creating your first repository
    11. Inside the init command
    12. Magnetic Thoughts
    13. Introduce yourself to Git
    14. How you will use Git
    15. Putting Git to Work
    16. Meanwhile, back at the HawtDog Dating Service ...
    17. Speaking of ...
    18. Congratulations on your first commit!
    19. What exactly does it mean to commit?
    20. What exactly does it mean to commit? (continued)
    21. Look before you leap
    22. The three stages of Git
    23. Great question!
    24. Git in the command-line
    25. A peek behind the curtain
    26. The multiple states of files in a Git repository
    27. A typical day in the life of a new file
    28. The object database is the “source of truth”.
    29. The index is a “scratchpad”
    30. Computer, status report!
    31. Whoa, easy tiger!
    32. You’ve made history!
    33. Magnetic Thoughts
  2. 2. Branching Out: Multiple trains of thought
    1. It all started with an email
    2. But things didn’t quite pan out...
    3. What would you do if you were Zelda?
    4. Updating the restaurant menu
    5. First things first
    6. Very astute!
    7. Choices ... so many choices!
    8. Switching tracks
    9. Magnetic Thoughts
    10. Back at the ‘80s Diner
    11. Send it back!
    12. Visualizing branches
    13. Branches, commits, and the files contained within
    14. Cubicle Conversation
    15. Working in parallel
    16. What is a branch, really?
    17. Switching branches, or switching directories?
    18. Some branches are more equal than others
    19. Bring it in!
    20. RTM (git branch edition)
    21. Making the fall menu official
    22. Some merges are fast-forward
    23. It doesn’t quite work the other way
    24. A little more Git setup
    25. It’s almost Thursday!
    26. Wait! You moved?
    27. It’s almost Thursday! (continued)
    28. It’s a merge commit
    29. Merge commits are kinda special
    30. Things don’t always go so smoothly
    31. I am so conflicted!
    32. I am so conflicted! (continued)
    33. I am so conflicted! (Ooof! Almost there)
    34. A typical workflow
    35. Magnetic Thoughts Solution
  3. 3. Looking Around: Investigating your Git repository
    1. In pursuit of the ultimate cilantro sauce recipe
    2. Commits aren’t enough
    3. Mirror, mirror on the wall
    4. How does git log work?
    5. Making git log do all the work
    6. What diff-erence does it make?
    7. A life of pluses and minuses
    8. A life of pluses and minuses (continued)
    9. Making your diffs easier on the eyes
    10. Diff-ing staged changes
    11. How’s the view from over there?
    12. Be careful when you compare branches!
    13. All together now!
  4. 4. Undoing: Fixing Your Mistakes
    1. Planning an engagement party
    2. An error in judgement
    3. Cubicle conversation
    4. Undoing changes to the working directory
    5. Undoing changes to the index
    6. Deleting files from Git repositories
    7. Committing to delete
    8. Editing commit messages
    9. Renaming branches
    10. Making alternative plans
    11. The role of HEAD
    12. Referencing commits using HEAD
    13. Traversing merge commits
    14. Unneeded commits
    15. Removing commits
    16. The three types of reset
    17. git reset --soft
    18. git reset (or git reset --mixed)
    19. git reset --hard
    20. Another way to undo commits
    21. Reverting commits
    22. Annnnnd that’s a wrap!