Skip to content

Instantly share code, notes, and snippets.

@raphaelchaib
Last active June 22, 2016 18:29
Show Gist options
  • Select an option

  • Save raphaelchaib/f77f09e2a27295519132 to your computer and use it in GitHub Desktop.

Select an option

Save raphaelchaib/f77f09e2a27295519132 to your computer and use it in GitHub Desktop.
Essential Git Commands

Essential Git Commands

Remove all items from Index, respecting Git ignore

The series of commands below will remove all of the items from the Git Index (not from the working directory or local repo), and then updates the Git Index, while respecting git ignores. PS. Index = Cache

First:

git rm -r --cached .
git add .

Then:

git commit -am "Remove ignored files"

View name of files that is diff between branches

git diff --name-status master..branchName

Git Configurations

Configure contact info

git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Change default editor from EMACS to VIM

git config --global core.editor "vim"

Use colors and show branches on git log

git config --global ui.color "true"
git config --global log.decorate "true"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment