Tips for Git (@tipsforgit) profile picture

Great tips for everyones favourite Distributed Source Control Management System. Formerly @agtad (A Git Tip A Day)

.git/objects/
Joined April 2012
Replying to @jpaulreed
@jpaulreed omg, I was a massive DHBIT fan too (used to stay up till 4-6am in the UK for live shows/irc), now makes sense why I loved @ShipShowPodcast so much :D
1
Only want to see root commits and merge commits? Give `git log --first-parent` a whirl. Interest esp. to #bzr users.
1
If like me you've spent any time in *gasp* bzr recently, give git-bzr-ng a go, it makes mirroring between repos easy buff.ly/1cuAPwZ
1
Use vim for your commit editor? Detect if you're in a commit via the filetype, which is "gitcommit", see :help filetype :help autocommand
Given a merge commit hash, you can revert it like so: git revert -m 1 <commit hash>
1
2
Want to find a merge commit? git log <oldest commit>..master --ancestry-path --merges Last one is your merge. Tomorrow we'll revert it!
Rebase every commit of the branch you're currently on, via @robmil: git rebase -i `git merge-base master HEAD`
List branches by date: for k in `git branch|perl -pe s/^..//`;do echo -e `git show $k|head -n 1`\\t$k;done|sort -r
Typo of the day "git stash poop"
2
1
Tired of doing --set-upstream-to after every first push to origin <branch>? Try this instead: git push -u origin <branch>
2
1
"(unable to update local ref)" error when trying to git pull? git prune
Want to clone and repo and jump directly onto a branch? git clone <url> -b <branchname>
pull latest master in dir of checkouts w/ #bash: for i in $(ls) do cd $i if [ -d ".git" ];then git checkout master && git pull fi cd - done
2
1
Always end up bumping a version number in master, tag & having to push both? git config --global alias.pt push --tags origin master git pt
1
1
Merging a branch and want to make sure there's always a commit for it (this isn't guaranteed)? git merge --no-ff <branch>
From the archive: see a diff with your commit teapawt.net/tipsforgit/status/2001…
Want to see a diff of your commit when filling in your commit message? git commit -v
From the archive: set upstream branch for a local branch for auto merge/push: teapawt.net/tipsforgit/status/2360… (NB in newer git its --set-upstream-to)
Need to set the upstream for a local branch so you get auto-merge push/pull? git branch --set-upstream <branch> <remote>/<branch>
From today going to drag some golden oldie tips out, just over Christmas.