|
git reset --soft HEAD^
|
Undo last commit, put changes into staging
|
|
git commit --amend -m "New Message"
|
Change the last commit
|
|
git reset --hard HEAD^
|
Undo last commit and all changes
|
|
git reset --hard HEAD^^
|
Undo last 2 commits and all changes
|
|
Delete from file system and git
|
git rm FILE.txt
|
|
Delete from git ONLY
|
git rm --cached FILE.txt
|
|
Colorizing Log
|
git config --global color.ui true
|
|
One commit per line
|
git log --pretty=oneline
|
|
Output log the way you want
|
git log --pretty=format:"%h %ad- [%an] %s"
|
|
Show log and modified lines
|
git log --oneline -p
|
|
Show log and insertions and deletes
|
git log --oneline --stat
|
|
Show log with a tree visual representation
|
git log --oneline --graph
|
|
Limit git log until some date
|
git log --until=1.minute.ago
|
|
Limit git log since some date
|
git log --since=1.day.ago
|
|
Range git log
|
git log --since=1.month.ago --until=2.weeks.ago
|
|
Range git log with specifc date
|
git log --since=2000-01-01 --until=2012-12-21
|
|
%ad
|
author date
|
|
%an
|
author name
|
|
%h
|
SHA hash
|
|
%s
|
subject
|
|
%d
|
ref names
|
|
First time
|
git push -u origin master
|
|
Then
|
git push
|
|
Git lol (log with some colors and visual tree)
|
git config --global alias.lol "log --pretty=oneline --abbrev-commit --graph --decorate"
|
|
Custom git output
|
git config --global alias.mylog "log --pretty=format:'%h [%an] %s' --graph"
|
|
Git status via git st
|
git config --global alias.st status
|
|
Git checkout via git co
|
git config --global alias.co checkout
|
|
Git branch via git br
|
git config --global alias.br branch
|
|
Git commit via git ci
|
git config --global alias.ci commit
|
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.