8

Git 处理文件与 revison 冲突问题 - 技术小黑屋

 3 years ago
source link: https://droidyue.com/blog/2021/04/25/fatal-ambiguous-argument-both-revision-and-filename-git/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

有一次,尝试使用git log 来查看某个分支(build.gradle)的历史提交时,遇到了这样的问题

git log build.gradle
fatal: ambiguous argument 'build.gradle': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
  • 分支名(build.gradle)与 当前目录下的文件build.gradle重复
  • 按照上面的提示使用-- 进行分割即可。
  • -- 前面的为revision 可以是分支,tag等
  • -- 后面的为 file 即要操作的文件

查看分支的历史提交

git log build.gradle --

查看某个文件的历史提交

git log -- build.gradle

droidyue_gzh_green_png.png

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK