Can I use “git checkout --” on two files?

前端 未结 6 1077
时光取名叫无心
时光取名叫无心 2020-12-10 10:00

Is it possible to use git checkout -- on multiple files in order to discard the changes?

If so how would I specify multiple files?

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 10:53

    Run the command multiple times

    git checkout -- path/to/file/one
    git checkout -- path/to/file/two
    

    Or specify the multiple files in the same line:

    git checkout -- path/to/file/one path/to/file/two
    

    You can also specify entire folders which will recurse to all files below them.

    git checkout -- path/to/folder
    git checkout -- . # for the current path
    

提交回复
热议问题