Skip to content

Instantly share code, notes, and snippets.

@nicl
Last active January 27, 2020 11:14
Show Gist options
  • Save nicl/fe2ff09d3fee1db96c1793024b5be4de to your computer and use it in GitHub Desktop.
Save nicl/fe2ff09d3fee1db96c1793024b5be4de to your computer and use it in GitHub Desktop.

Git commands sufficient for 99.9% of the time:

git status
git add -A
git branch
git checkout [-b]
git rebase [-i] master // interactive rebase is amazing
git reset HEAD [file] // when I accidentally add something
git reset HEAD^1 // for when you accidentally commit on master
git log
git diff [--cached]
git commit // try and avoid '-m' and single-line commits for most stuff
git commit --amend --no-edit // quick 'fixup'
git pull
git remote -v
git stash

Never git merge (except through git pull).

If you have a messy merge/rebase conflict, prefer rebranching off the branch you are merging into and copying over your changes manually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment