Git Command Wall

Config

git config --global user.name "Your name"
  • usersame globally
git config user.name "Your name"
  • set username locally
git config --global user.email "user@example.com"
  • set username email
git config --global color.ui true
git config --global alias.st status
  • git st will work as git status from now
git config --list
git config -l
  • show all config at this file location
git config --global -l
  • show all global config
git config --global core.editor vim
  • open editor Vim when Git ask you to input messages

Status

git status

Push

git push

Pull

git pull 

Undo

git reset
git reset --soft HEAD^
git reset --hard HEAD^
git checkout -- 

Diff

git diff
git diff --staged

Stash

git stash & git stash save
git stash save --include-untracked
git stash apply
git stash drop
git stash list
git stash pop

Rebase

git checkout [branch]

Branch

git branch
git branch -r
git branch -d [branch name]
git branch -D [branch name]

Tag

git tag
git tag -a [v1.0.0] -m 'version message'
git push --tags
git checkout v1.0.0