Skip to content

Instantly share code, notes, and snippets.

@ericdouglas
Last active March 25, 2016 11:01
Show Gist options
  • Select an option

  • Save ericdouglas/2081f655aa9443c9d296 to your computer and use it in GitHub Desktop.

Select an option

Save ericdouglas/2081f655aa9443c9d296 to your computer and use it in GitHub Desktop.
Git commands

Git Commands and Concepts

  • git config --global user.name "Your Name"
  • git config --global user.email "youremail@example.com"
  • git config --global core.editor vim
  • git init: Start a new git repository
  • git status (gst): See the project status
  • Working areas: .git directory, staging area and working directory. Image
  • git add <filename> (ga): Add a file to the Staging Area
  • git add . (gaa): Add all files to the Staging Area
  • git add *.js: Add all .js files to the Staging Area
  • git rm --cached <file>: Remove a new file from the Staging area
  • git commit -m "My first commit": Create a commit with a message
  • git commit -v -a (gca): What I use most. -v is verbose, shows the diff at bottom and more meaningful information. -a add all files that have been modified and deleted, but new files you have not told Git about are not affected.
  • git help <command>: Open the manual for the respective command. USEFUL!
  • git log (glg, glgg, glo, glog): Show all commits - history of the project
  • git reset HEAD <filename> (grh): Remove an modified file from the Staging area
  • git checkout <filename> (gco): Remove an modified file from the Staging area and undo its alterations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment