-
Notifications
You must be signed in to change notification settings - Fork 0
Quintessential Git
Dan edited this page Sep 29, 2016
·
1 revision
My cheat sheet for Git
git config --global user.name "Your Name"
git config --global user.email "your_email@whatever.com"
git config --global core.autocrlf true
git config --global alias.a add
git config --global alias.l "log --graph --date=short"
git config --global alias.s status
git config --global alias.co checkout
git config --global alias.d diff
git config --global alias.b branch
git config --global alias.u rebase
git config --global alias.c commit
git config --global alias.p pull
git config --global alias.pr "pull --rebase"
git config --global alias.pu push
git config --global alias.h 'log --pretty=format:"%h %ad | %s%d [%an]" --graph --date=short'
git config --global alias.t 'cat-file -t'
git config --global alias.d 'cat-file -p'
git clone -b <remote-branch> <url>
git checkout -b <tracking-branch-name> remotes/origin/<remote-branch-name>
git reset --soft HEAD^
git reset HEAD^
Completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit
git reset --hard HEAD^
git rm --cached filename
git rm -r --cached <your directory>
git config core.filemode false
git reset --soft HEAD^
git remote -v
git remote set-url origin <url>