Skip to content

Instantly share code, notes, and snippets.

@mlangone
Forked from mohokh67/fix gitignore.md
Created October 30, 2020 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mlangone/846ddd0a4e917581df31e12c6a09d9bd to your computer and use it in GitHub Desktop.
Save mlangone/846ddd0a4e917581df31e12c6a09d9bd to your computer and use it in GitHub Desktop.
Fix the .gitignore and untrack files which are already added

Untrack files which are already added in gitignore file

  1. Commit all your changes

  2. Remove everything from the repository cache. Go to your repo directory and run this command.

git rm -r --cached .

It will only clear the cache. Your files and git history will stay.

  1. Re add everything
git add .
  1. Commit the fix
git commit -m 'fix .gitignore'

Sit back and relax. It'd done.

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