Skip to content

Instantly share code, notes, and snippets.

@syranez
Created November 14, 2011 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syranez/1365239 to your computer and use it in GitHub Desktop.
Save syranez/1365239 to your computer and use it in GitHub Desktop.
Git Beginners Cheatsheet
#
# Git Tag
#
Lightweight: git tag <name> <commit-id>
Annotated: git tag -a <name> <commit-id>
Show tag: git show <name>
Check Annotated: git tag -v <name>
# remove file from index but do not delete it.
$ git rm --cached file
# diff staging area with index
$ git diff --staged
# amend a commit
$ git commit --amend
# e. g. add a file
$ git commit -m "first commit with forgotten file"
$ git add forgotten_file
$ git commit --amend # edit commit message on base current stage
#
# Remotes
#
# Tell me something about my known remotes
git remote
# Tell me something about [remote-name]
git remote show [remote-name]
# add remote
git remote add [remote-name] [remote]
# rename [remote-name]
git remote rename [remote-name] [new-remote-name]
# get remote
git fetch [remote-name]
#
# Pull (=fetch + merge)
#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment