Skip to content

Instantly share code, notes, and snippets.

@ainsofs
Created April 16, 2015 01:50
Show Gist options
  • Save ainsofs/2b80771a5582b7528d9e to your computer and use it in GitHub Desktop.
Save ainsofs/2b80771a5582b7528d9e to your computer and use it in GitHub Desktop.
Clear .gitignore cache
# remove specific file from git cache
git rm --cached filename
# remove all files from git cache
git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
@charanjit-singh
Copy link

👍

@stephen-ifmacinema
Copy link

Great

@tiagobbraga
Copy link

👍

@Daniel-Monroy
Copy link

Great !!

@luisgagocasas
Copy link

👍

@angelzarazua
Copy link

Nice!

@DmmitryIs
Copy link

Like

@ducnpdev
Copy link

Like

@akshuvo
Copy link

akshuvo commented Mar 14, 2022

Run all command together at once:
git rm -r --cached . && git add . && git commit -m ".gitignore is now working"

@Abimomin
Copy link

Abimomin commented Jun 3, 2022

@akshuvo this command deleted all the files of my git repository

@akshuvo
Copy link

akshuvo commented Jun 3, 2022

@Abimomin This is just a short version of the code which showed in the gist. Maybe you didn't push your codes or something went wrong.

@mamutalib
Copy link

remove all files from git cache

Just copy these command & fixed the problem.

git rm -r --cached .
git add .
git commit -m "untracked fixed"

@ElWazy
Copy link

ElWazy commented Mar 28, 2023

👍

@muhamad-andhika-bagaskara

image

@Sherlockboy
Copy link

👍

@lba-source-code
Copy link

helpful information, massive thanks!

@aamahi
Copy link

aamahi commented Dec 19, 2023

Nice!!! It's working good.

@chadhumphrey
Copy link

easy peasy, lemon squeezy!

@juanmaluzzi-uala
Copy link

thank you!

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