Skip to content
SoftwareSolutions.net
Cheat sheet

Git Commands Cheat Sheet

The everyday Git commands for starting a repository, saving changes, branching, syncing with a remote and reviewing history.

Git records changes to a project in commits. These commands cover the everyday workflow for one person working on a project.

Start and inspect

  • git init creates a new repository
  • git clone URL copies an existing repository
  • git status shows changed files
  • git log --oneline shows the commit history briefly

Save changes

  • git add file.txt stages one file
  • git add . stages all changes in the folder
  • git commit -m "message" saves staged changes as a commit
  • git diff shows changes not yet staged

Branches and sync

  • git branch lists branches
  • git switch -c name creates and switches to a branch
  • git merge name joins another branch into the current one
  • git pull downloads and merges remote changes
  • git push uploads your commits to the remote