git config -l # for local config
git config --global -l # for global config
git config --global user.name "name"
git config --global user.email "email address"
git config --global credential.helper cache # store login credentials
git add remote https://repo_here # add new remote repo
git remote -v # list of remote repo
git remote show origin # more info on origin
git add .
git add file
git branch <branch> # create a new branch
git checkout <branch> # checkout to the branch
git checkout -b <branch> # create and switch to the branch
git branch -d <branch> # delete branch locally
git push origin --delete <branch> # delete remote branch
git merge <branch> # merge branch with current branch
git merge --abort # merge start over
git commit -m ""
git commit --amend -m "message" # amend previous commit
git commit -a -m "message" # add and commit together
git push origin
git pull origin
git pull --rebase # to rebase local head with remote head
git fetch
git push --set-upstream origin branch / git push -u origin branch # change upstream to branch
git clone link
git status
git log
git log -p # commit's history including all files and their changes
git log --graph --oneline # limits commit message to one line
git log --graph --oneline --decorate # same as previous
git log --graph --oneline --all # for all branches
git show commit-id # shows a specific commit
git diff
git diff file
git diff --staged # staged files
git reset [file] # go back to previously known working state
git rm [file] # remove file working directory and staging area
git stash # Put current changes in your working directory into stash for later use.
git stash save "msg" # prev with a msg
git stash pop # bring the most recent stash to the working directory and delete from stash history
git stash pop stash@{<number>} # bring numbered entry to the wd and delete from stash history
git stash apply stash@{<number>} # just like prev but doesn't delete from stash history
git stash drop stash@{<>} # delete the entry from stash history # pop = apply+drop
https://gist.github.com/gunjanpatel/18f9e4d1eb609597c50c2118e416e6a6
https://www.csd.uoc.gr/~hy255/refcards/git-refcard.pdf