Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Sunday, February 5, 2012

Some useful Git commands and resources



Git Cheat Sheets


Enable GIT colors commands

  • git config --global color.diff auto
  • git config --global color.status auto
  • git config --global color.branch auto
  • git config color.interactive auto
  • Or, you can set all of them on with the color.ui option:
  • git config color.ui true

Creating & pushing new branch

  • First, you must create your branch locally
  • git checkout -b your_branch
  • push the branch to the remote repository origin and tracks it
  • git push -u origin your_branch

listing all files in a commit:

$ git show --pretty="format:" --name-only bd61ad98

Restoring a deleted file in a Git repo:

git checkout $(git rev-list -n 1 HEAD -- "$file")^ -- "$file"