有很多git命令可以在其中指定文件名。它们似乎不适用于我的项目,因为这些命令仍然适用于所有文件,而不是一个。
示例:
git add <file> # causes adding all files to the stage, not just one
git checkout <file> # discard all changes
git log -- file # works as usual git log command
git blame <file> # this one seems to work right
我做错了什么还是我的git有问题?如何解决它,尤其是git add file
问题?
git add <file>
的详细示例:
$ git status
On branch master
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: file1
modified: file2
modified: file3
$ git add file1
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: file1
modified: file2
modified: file3