The secrets
of the Git

Software Gardener
at CouchCommerce

 Every commit is a full snapshot.  

 no Deltas for fuck's sake 

 Let's Talk About Branches 

 A branch is just a name for a specific commit

 well almost

 Committed on the wrong branch? 

git branch featureBranch
git reset --hard HEAD~1

What the

"The HEAD is just a pointer to where your working directory should currently be on" --cburgdorf

How is that useful?

 git makes it hard to lose work

 As long as you ever had it COMMITTED 
Commit early, commit often 

 the reflog 

"The reflog is a history of all movements of the HEAD" --cburgdorf


commits that are not reachable by any branch/tag will be GC'ed after 30 days


 Commit early, Commit often 

 yet, nobody wants to read this 

 We want this 


 your coworkers will thank you! 


 ""I'll fix that later"" 

 as a workflow 

 4 commands: wip, ap, add -p, rebase -i 


 Cherry picking 

git cherry-pick sha4711

git cherry-pick first~ .. last

 Avoid unnecessary Merge commits 

 Use a rebase workflow 




 merging blindly means 

 - your history becomes a mess 
 - YOU hide information in merge commits 
 - harder to do git bisect 
 - HARDER TO DO cherry picking 

 make the console your friend 

git config --global '!git add -A && git commit'

git config --global alias.lg '!git log --pretty=one-line --abbrev-commit --graph --decorate'

git config --global alias.wip '!git add -A && git commit -m "WIP"'

git config --global alias.ap '!git add -A && git commit --amend --no-edit'

 One more thing 



The secrets of the Git ninjas

By cburgdorf

The secrets of the Git ninjas

  • 4,362