Friday, March 30, 2012

Git log

while git log is standard, quite often I found the need to have a stripped down version of the logs. Git alias to the rescue again

This gives you a one line representation of the hash tag, the author and message

vi ~/.gitconfig
[alias]
lg = log --pretty=format:'%Cred%h %Cblue%an:%Creset%s'

If you want the entire history this works great
lgall = log --graph --oneline --decorate --all

Thursday, March 29, 2012

git remove untracked files

I do a lot of branch switching and files which are ignored in one branch show up as untracked files. This gets annoying during merge conflicts as then its difficult to keep track of whats actually conflicted and new and whats not.

After trying around a few commands this alias works great for me

vi ~/.gitconfig

[alias]
remove-untracked = "!git ls-files --other --exclude-standard | xargs rm;"


Now just run git remove-untracked and the eyesore is gone!