I have been looking for way to remove all of the deleted files (which I have deleted in my local file system) from my git repository. The command that I found is this:
git rm $(git ls-files -d)
This is the first time that I have seen $(...) in a git command. What does the $(...) do within this command?
It's shell syntax, not part of git. The enclosed command is run, and the resulting output is used as the argument(s) for the primary command. That is, if git ls-files -d outputs foo.txt and bar.txt, your command is equivalent to
git rm foo.txt bar.txt
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