I removed 777 files which were in Git's branch newFeature by
rm !(example)
I would like to commit. Git ask me to manually remove each of the removed files by
git rm file
It would take a lot of time to write the above command for all 777 files which names are not similar.
How can I remove these 777 files in my Git branch newFeature? I want to keep them as a backup for later use, but now, I want to be without them.
git add -u
It will "git delete" all files you removed.
From Git add:
u
--update
Update only files that git already knows about, staging modified content for commit and marking deleted files for removal.
This is similar to what "git commit -a
" does in preparation for making a commit, except that the update is limited to paths specified on the command line.
If no paths are specified, all tracked files in the current directory and its subdirectories are updated.
The "plumbing way" was indeed some kind of script one-line
for i in ` git st | grep deleted | awk ‘{print $3}’ ` ; do git rm $i; done
or for Windows box with GnuWin32
git st | grep deleted | gawk "{print \"git rm \"$3}" | cmd
But git add -u
is the main porcelain way to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With