Git Command Line

Common tasks

Git is primarily a command line tool, here are a few commands that you’ll use regularly:

  • $ git init To turn a folder into a Git repository
  • $ git status Shows you what has changed in your repository
  • $ git difftool Allows you to visually compare the changed files
  • $ git add Adds a file to Git and readies it for committing
  • $ git commit -m "Your commit message." Saves the current state of your files into Git’s history
  • $ git clone Get a copy of a repository
  • $ git push Send your commits to a remote repository
  • $ git pull Get changes from a remote repository and merge them with your local copy
  • $ git rm Delete a file from the repository
  • $ git checkout Move backward and forward in history
  • $ git branch Create a new, different version of the repository to add a new feature

Most Git GUI tools have buttons that perform the same commands you’d execute with the Terminal.