advanced™ git features and how to survive vim
advanced™ git features and how to survive vim
git makes it
insanely hard too lose
code
every commit is a full snapshot!
No deltas – for fuck sake
A branch is nothing more than a name for a specific
commit
the HEAD is just a pointer to where your working
directory should currently be on
the reflog is a history of all movements of the HEAD
commits in the reflog that are not reachable by any branch will be gc‘ed after
30 days
Noticed you
are on the
wrong branch?
git checkout –b newBranchgit checkout previousBranchgit reset –hard lastValidCommit
git got your back!
git checkout –b newBranchgit checkout previousBranchgit reset –hard HEAD~1
..or relative
„
“
commit early & often
yet nobody want‘s to read this!
git rebase –i 6f50a39~1
this is what people should see
Need the lastfive commits
from branch <foo>without merging any previous commits?
git cherry-pick first~..last
avoid unnecessary merges
use a rebase workflow
because
Face it, here is what happens if you merge blindly
- your history becomes a mess- you hide information in merge commits- harder to do git bisect- harder to do cherry-picking
Face it, here is what happens if you merge blindly
- 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
//commit ALL THE THINGS for fuck sake!git config --global alias.ca '!git add -A && git commit'
//we don‘t need a gui log! git config --global alias.lg 'log --pretty=oneline --abbrev-commit --graph --decorate'
Useful links!
http://www.randyfay.com/node/91http://stackoverflow.com/questions/457927/git-workflow-and-rebase-vs-merge-questions
Get in touch.
http://twitter.com/cburgdorfhttps://github.com/cburgdorf