- git checkout -b branch-name origin/branch-name
- git remote add origin https://github.com/username/reponame.git
- git remote -v
- git branch --remote # to see all the branches from remote
- git checkout branch-name # checkout a branch from remote
- git remote rm destination # delete remote
- git remote rename origin destination # change remote name from 'origin' to 'destination'
- git stash
- git stash save "my_stash" # save it with a custom message
- git stash save -u # stash uncommited and untracked changes
- git stash list
- git stash show -p stash@{1} # show stash changes
- git stash apply
- git stash apply stash@{0} # apply the staging changes at 0
- git stash clear
- git stash drop stash@{0} # remove the stashed work
- git stash pop stash@{0} # apply the stashed work and remove it from the stash
- git rebase -i origin/master , then replace any the pick keyword with fixup from line 2 to the end of the commit list. afterwards save + exit., the force push : git push -f
- git fetch --all
- git reset --hard origin/master
- git pull origin master
- git checkout -b mybranch
- git push -u origin mybranch #(this is similar to git branch --set-upstream my_branch origin/my_branch)
- git branch -r
- git branch -v -a
- git fetch --prune
- git fetch --all --prune
- git remote update --prune
- git branch -d the_local_branch
- git push origin :the_remote_branch
- git clean -n #show what will be deleted
- git clean -fd #remove directories
- git clean -fX #remove ignored files
- git clean -fx #remove ignored and non-ignored files
- git config --global color.ui auto
- git config --global core.editor vim
- git config --global help.autocorrect 1
- git config --global color.ui auto
- git config --global credential.helper cache
- git config --global alias.co checkout
- git config --global alias.br branch
- git config --global alias.ci commit
- git config --global alias.st status
- git config --global alias.pr 'pull --rebase'
- git config --global alias.prc 'rebase --continue'
- git config --global alias.pra 'rebase --abort'
- git config --global alias.pf 'push -f'
- git config --global alias.fa 'fetch --all'
- git config --global alias.hist 'log --oneline --decorate --graph'
- git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit"
- git reset --hard df9cf323 && git clean -f
find /path/to/files* -mtime +5 -exec rm {} ; 💃