Skip to main content

Posts

Showing posts from February, 2014

Useful tool and commands of using Git

#1 If you tired of entering the username and password, try
Windows Credential Store for Git
http://gitcredentialstore.codeplex.com/

#2 Display log in a better way
git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit

#3 Alias in .gitconfig file
You can define whatever you like to, below is my sample
[alias]
st = status
ci = commit -v
cl = clean -f
co = checkout
cot = checkout dxxx (comments: check out a team branch)
com = checkout master
d = diff
f = fetch
m = merge
mm = merge master
md = merge dxxx (comments: dxxx is the branch name started with d)
p = pull
pr = pull --rebase
ps = push

#4 how to rollback committed code(before push)
git reset --soft HEAD^

#5 leaving offending file from staged
git  reset HEAD <path>