The Subset of Git I Use
Git has a huge number of commands and I’ve only committed a small subset of them all to memory. These are the commands I use on a regular basis without needing to refer to the docs or man pages. They are roughly ordered by frequency of use.
This can serve as a beginner’s guide to a set of commands to be productive with Git, or perhaps a window into the idiosyncratic way another developer uses it.
git status
git add --all
git commit
git commit --amend
git checkout <branch>
git diff
git diff --cached
git checkout -b <branch>
git merge <branch>
git log
git fetch
git push <remote branch>
git diff <branch>
git reset --hard
git rebase <branch>
git merge
while working locally to reduce the number of merge commits cluttering the history, but could easily get by without it.
git branch -u <tracking branch>
git branch -D <branch>
git mv <filepath> <filepath>
git clone <repository>
git remote <-v|add|set-url>
And that’s basically it. I will ocassionally use other more complicated commands like git filter-branch
, but will probably need to refer to the docs to remember their specifics. There are also some simple commands I’m aware of but don’t tend to bother with much, like git rm
(using git add --all
makes it unnecessary), or git stash
(I prefer to just make a temporary commit to come back to, it works and saves me from memorizing yet more commands).