Skip to content

Instantly share code, notes, and snippets.

@danyaljj
Created June 26, 2015 00:29
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 danyaljj/ad4412e8294ceb0e1533 to your computer and use it in GitHub Desktop.
Save danyaljj/ad4412e8294ceb0e1533 to your computer and use it in GitHub Desktop.
Git summary

Git

  • Unstaging (undo the file after adding it):

git reset FILENAME

  • untrack a file:

git rm --cached file_name

  • Removing files from git repo (remote), after they have been removed from disk (local):

git rm $(git ls-files --deleted)

  • Show all branches:

git branch -a

  • Show remote branches:

git branch -r

  • Show past versions of a file:

git show REVISION:path/to/file

For example 4 commits before the HEAD for the main.c file.

git show HEAD~4:src/main.c

  • Change the origin:

git remote set-url origin git://new.url.here

  • List the configuration:

git config --list

or in geberal

git config

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment