Skip to content

Instantly share code, notes, and snippets.

@nalumachurakesh
Forked from kipyegonmark/gitignore-add.md
Created November 24, 2020 21:14
Show Gist options
  • Save nalumachurakesh/c6a0485bec86264009e86e41a1359ec3 to your computer and use it in GitHub Desktop.
Save nalumachurakesh/c6a0485bec86264009e86e41a1359ec3 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