Quick git
Reference
Discard unstaged changes
git stash save --keep-index git stash drop
Set Nice Colours
I like colours and it makes things pretty! To set the colours in git to show when you type the various commands use the following commands.
git config --global color.diff auto git config --global color.status auto git config --global color.branch auto
Remove remote branches that are "gone"
git fetch -p && for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`; do git branch -D $branch; done
Nice shell script from SO (remove local branches no longer on remote).
http://cheat.errtheblog.com/s/git/ http://kernel.org/pub/software/scm/git/docs/git-show-ref.html http://kernel.org/pub/software/scm/git/docs/git-show.html http://stackoverflow.com/questions/424071/list-all-the-files-for-a-commit-in-git http://git.or.cz/course/svn.html
git push --force
fails
When git push --force
fails on a local bare repository it can
be fixed by chaning a value in the remote repository configuration file. Upon
creation non-fast-forwards are denied:
[core] repositoryformatversion = 0 filemode = true bare = true sharedrepository = 1 [receive] denyNonFastforwards = true
Change this value to false and a push force will be allowed:
[core] repositoryformatversion = 0 filemode = true bare = true sharedrepository = 1 [receive] denyNonFastforwards = false
If a force push is executed often (not a good idea btw) then the repository will probably need garbage collection.