简体   繁体   中英

Piping the Results of git status to Subsequent Commands

I have a large list of active files in my Git repository. One change I made was deleting a large number of images across a number of directories. I want to commit that change immediately but I don't want to include all active files and I don't want to manually type out git rm myfile.png for every single image.

So essentially what I want to do is run git rm on all active files ending in .png . I'm trying to accomplish this by piping the results of git status into git rm but I'm having trouble isolating the file name and getting this to work as I'd like.

Is this a proper use of piping and if so what syntax do I need?

Any help is appreciated, thanks.

If you already removed the files, you can type:

git add -u

And they will be removed from git repository.

From git help add :

-u, --update
           Only match <filepattern> against already tracked files in the index
           rather than the working tree. That means that it will never stage
           new files, but that it will stage modified new contents of tracked
           files and that it will remove files from the index if the
           corresponding files in the working tree have been removed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM