Skip to content

Instantly share code, notes, and snippets.

@ldong
Last active August 29, 2015 14:03
Show Gist options
  • Save ldong/5835805f5e18dc3cad49 to your computer and use it in GitHub Desktop.
Save ldong/5835805f5e18dc3cad49 to your computer and use it in GitHub Desktop.
A git common commands I created for other people

You are gitting this

git diff

git diff --name-only SHA1 SHA2
git diff --name status [TAG|SHA1]

git ls-files ls-tree

git ls-tree -r --name-only <tree-ish>

git reflog

can used for change HEAD after git reset --hard HEAD~

git log

git log ~= git whatchanged
# what files being changed
git log --oneline --name-status <HASH> -1
git whatchanged -1 --format=oneline | wc -l

https://www.atlassian.com/git/tutorial/git-basics#!log

git show

git-show - Show various types of objects

http://git-scm.com/docs/git-show

git revert

http://stackoverflow.com/questions/4114095/revert-to-previous-git-commit

git reset

https://www.atlassian.com/git/tutorial/undoing-changes#!revert

In a nutshell, git revert saves changes in the git history

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment