GIT: I want to unstage all files matching a certain pattern

后端 未结 8 739
深忆病人
深忆病人 2021-01-04 20:52

I would like to run

git reset *.foo

but this errors out.

I think I need to use a pipe, but I\'m not sure how to do this.

Th

8条回答
  •  余生分开走
    2021-01-04 20:59

    for i in `git status --porcelain | grep '^D.*\.foo$' | sed 's/^D \+//'`; do
        git reset HEAD "$i"
        git checkout "$i"
    done
    

提交回复
热议问题