There are many ways to do that you can simply write this :
git rm --cached not-to-be-commit.txt
And Please try this one too (The —amend command), it always works for me. I practiced each and every command and wrote here. Let me know if you have other suggestions. Thanks !!
I use --amend everyday to squash changes into the last commit. If you look into the last commit on the branch after doing git --amend, you'll see that the file you didn't want to add has become part of the commit. :-)
git rm --cached would indeed work too, however it is the "old way" of doing it. If you have a recent git version, when you run git status, it would suggest to use git restore --staged.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are many ways to do that you can simply write this :
git rm --cached not-to-be-commit.txt
And Please try this one too (The —amend command), it always works for me. I practiced each and every command and wrote here. Let me know if you have other suggestions. Thanks !!
I use --amend everyday to squash changes into the last commit. If you look into the last commit on the branch after doing
git --amend
, you'll see that the file you didn't want to add has become part of the commit. :-)git rm --cached
would indeed work too, however it is the "old way" of doing it. If you have a recent git version, when you rungit status
, it would suggest to usegit restore --staged
.