Git - why are double dashes needed when running a command on a deleted file?

前端 未结 3 1609
我在风中等你
我在风中等你 2021-01-02 05:35

Consider a git repository, where a file was once deleted.

git rm path/to/file
git commit -a -m\"testing\"

Ok, now I want to see the g

3条回答
  •  时光取名叫无心
    2021-01-02 06:12

    there never was a tag by that name.

    Why do you say that? git tag path/to/file works just fine.

    It really is as simple as it looks: git rm takes pathnames only; git log takes ref names and path names, refnames first, and anything that could be a pathname could also be a ref name -- this isn't so much a rule for what could be a ref name as the definition.

    On small projects it'd be easy for git log to decide that if it's valid at all it has to have been a path to a source file at some point, but at this point you have to make a judgement call balancing the likelihood and cost of all the possible screwups here. Is it likelier that you're asking for the logs for a file that no longer exists, or that you fatfingered an existing path name or an existing ref? git log remote/ref is very common. I think git's just presuming a name that matches nothing current is likeliest to be a typo.

提交回复
热议问题