Branches as Savepoints
Because a Git branch is just a 40-byte file on disk, it takes orders of magnitude more time for you to tell the computer to create a branch (by typing
git branch foo) than for your computer to actually do it.
And because branches are references, and (say it with me now) references make commits reachable, creating a branch is a way to "nail down" part of the graph that you might want to come back to later.
And because neither
git merge nor
git rebase will change your existing commits (remember, a commit's ID is a hash of its contents and its history), you can create a temporary branch any time you want to try something you're even just a little bit unsure about.
In other words, creating a branch is like saving your game before you battle the boss.
- About This Site
- Git Makes More Sense When You Understand X
- Example 1: Kent Beck
- Example 2: Git for Ages 4 and Up
- Example 3: Homeomorphic Endofunctors
- Example 4: LSD and Chainsaws
- The Internet Talks Back!
- Graph Theory
- Seven Bridges of Königsberg
- Places To Go, and Ways to Get There
- Nodes and Edges
- Attaching Labels to Nodes
- Attaching Labels to Edges
- Directed Versus Undirected Graphs
- Graphs and Git
- Visualizing Your Git Repository
- The Reference Reference
- Making Sense of the Display
- Garbage Collection
- Experimenting With Git
- References Make Commits Reachable
- My Humble Beginnings
- Branches as Savepoints ←HEAD
- Use Your Targeting Computer, Luke
- Testing Out Merges
- Rebase From the Ground Up
- Cherry-Picking Explained
- Using 'git cherry-pick' to Simulate 'git rebase'
- A Helpful Mnemonic for 'git rebase' Arguments
- The End