Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git remove ignored files after commit

Tags:

git

I have the following lines in my gitignore file:

!/assets/path-one/**/*.*
!/assets/path-two/**/*.*
!/assets/path-three/**/*.*

I pushed the changes, and all the files are included in the commit. What I want is to remove the ! and remove all the files from the commit, how can I do this?

/assets/path-one/**/*.*
/assets/path-two/**/*.*
/assets/path-three/**/*.*

When I update the file, I see only the changes in the .gitignore file.

like image 687
undefined Avatar asked Jan 26 '26 10:01

undefined


2 Answers

First commit your changes and Try removing cache:

git rm -r --cached .

git add .

git commit -m "fixed untracked files"`

This might help you: https://stackoverflow.com/a/11451731/8866182.

like image 62
samrat shakya Avatar answered Jan 28 '26 23:01

samrat shakya


You can acheive it in following setps

  1. You need to remove the folders (Keep a backup of the folders if you want the contents)

  2. update the gitignore by removing (!), add and commit the changes

  3. Replace the backup if you need

like image 21
SAMUEL Avatar answered Jan 28 '26 23:01

SAMUEL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!