Skip to content

Instantly share code, notes, and snippets.

@pavan538
Last active April 26, 2019 02:21
Show Gist options
  • Save pavan538/438bf926b39906a5d3a8a39e58637b07 to your computer and use it in GitHub Desktop.
Save pavan538/438bf926b39906a5d3a8a39e58637b07 to your computer and use it in GitHub Desktop.
Git cheat sheet

Git untrack the file

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"

Googled : 3 ways of excluding files

.gitignore applies to every clone of this repository (versioned, everyone will have it),

.git/info/exclude only applies to your local copy of this repository (local, not shared with others),

~/.gitconfig applies to all the repositories on your computer (local, not shared with others).

actually requires to set a configuration on your computer :

git config --global core.excludesfile '~/.gitignore'

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