Skip to content

Instantly share code, notes, and snippets.

@mohokh67
Last active September 14, 2023 14:09
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save mohokh67/c363e095adc8beb26b1fe7557bf9f289 to your computer and use it in GitHub Desktop.
Save mohokh67/c363e095adc8beb26b1fe7557bf9f289 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