- git add .
- git commit -m "yummie! bananas!"
- git push origin master
- -u (set upstream to use only git push)
- git status
- git diff HEAD / git diff --staged
- git log
- git init
- git remote add origin https://xxx.git
- git pull origin master
- git rm file
- git branch new-branch
- git checkout new-branch
- git checkout master
- git merge new-branch
- git branch -d new-branch
- git checkout -b new-branch
- git reset...
- git reset . (Unstage changes)
- git reset --soft HEAD^ (Undo last commit, changes into staging)
- git reset --hard HEAD^ (Undo last commit + changes)
- NOTE! HEAD^^ (last 2 commits) / NOTE2! HEAD~1 (last)
- git checkout filename (Back to last commit state (discard changes))
- git stash (Saves local changes)
- git stash pop (Loads them)
- git config --global credential.helper store (Dangerous, saves creds on disk)
- git config --global credential.helper 'cache --timeout=300' (Doesn't ask creds for 300 seconds)
- git config --global --unset credential.helper (Disables)
- git fetch (Refresh available changes from all branches (no pull))
- git fetch branchname (from specified branch)
- git commit --amend -m "new message" (Append to last commit, overwrites message)
- git remote set-url origin https://xxx.git (changes remote address for origin)
- git pull origin master --allow-unrelated-histories (merge unrelated histories)