Cheat Sheet

Git Commands Cheat Sheet (The Ones You Actually Use)

Git is essential — and easy to forget the moment you need it. Here is a no-fluff reference to the commands that cover 95% of everyday work.

Git commands cheat sheet

Start a project

git init                 # start a new repo


git clone <url>          # copy a remote repo

The daily loop

git status               # what has changed


git add .                # stage all changes


git commit -m "message"  # save a snapshot


git push                 # send to the remote


git pull                 # get the latest changes

Branches

git branch                 # list branches


git checkout -b feature-x  # create and switch to a branch


git checkout main          # switch back


git merge feature-x        # merge a branch into the current one

Fixing mistakes

git restore <file>       # discard changes in a file


git reset --soft HEAD~1  # undo the last commit, keep changes


git revert <commit>      # safely undo a commit with a new one


git stash                # shelve changes for later


git stash pop            # bring them back

See what happened

git log --oneline        # compact history


git diff                 # see unstaged changes

Building something bigger?

Good version control is part of building software properly — alongside testing, deployment and clean code. If you have a project that needs real engineering, let’s talk.

Ask us anything×