Skip to content

Instantly share code, notes, and snippets.

@kipyegonmark
Created March 16, 2016 13:03
Show Gist options
  • Save kipyegonmark/2a76269bc6b0df0a22df to your computer and use it in GitHub Desktop.
Save kipyegonmark/2a76269bc6b0df0a22df to your computer and use it in GitHub Desktop.
Adding a .gitignore to an existing repo. Source to original link -> http://monkeyhacks.com/link/adding-a-gitignore-to-an-existing-repo

First commit any outstanding code changes, and then, run this command:

git rm -r --cached

This removes everything from theindex, then just run:

git add

Commit it:

git commit -m ".gitignore is now working"

You can also remove individual files, if you don't want such a drastic approach:

git rm --cached filename

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