
Great tips for everyones favourite Distributed Source Control Management System. Formerly @agtad (A Git Tip A Day)
.git/objects/
Joined April 2012
- Tweets89
- Following4
- Followers198
- Likes0
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
Get a list of filenames changed in your branch, useful for determining tests to run in CI:
gist.github.com/1stvamp/1b24…
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
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
Tired of doing --set-upstream-to after every first push to origin <branch>? Try this instead:
git push -u origin <branch>
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
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…
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>
