I am using git in my project at Linux platform. I have plenty of files in a particular directory. I modified some 50 above files in that directory and didn't stage and commit it. I wish to delete all other unmodified files from that directory? Is there a way to do this, using git and Linux Commands?
Not sure why you would want to do this.... but you can:
# Save changes to stash git stash save # Remove everything left rm -rf ./* # Checkout (restore) all of the changed files git stash show --stat | grep -v changed | sed -e 's/|.*$//;' | xargs git checkout # Restore the changes to those files git stash pop