【问题标题】:git blame for files that don't exist in current branchgit责备当前分支中不存在的文件
【发布时间】:2016-12-28 23:48:14
【问题描述】:

我有一个文件存在于 branch_A 但不存在于 branch_B。

我想跑步

> git checkout branch_B
> git blame branch_A file

但是,git 抱怨我在本地没有该文件 - 这是正确的,但忽略了我想归咎于 branch_A 的事实。我希望 git blame 能够检查相对于所需分支而不是签出分支的文件是否存在。

如果我在分支 B 上运行它,我可以欺骗 git blame 做我想做的事:

> touch file
> git blame branch_A file

有没有一种简单的方法可以做到这一点?

【问题讨论】:

    标签: git git-blame


    【解决方案1】:

    显然,这样做的方法是:

    > git blame branch_A -- file
    

    而不是

    > git blame branch_A file
    

    【讨论】:

    • 是的,这很有趣。如果文件存在于当前分支中,它将按预期工作。对我来说似乎是一个错误。
    猜你喜欢
    • 2023-01-14
    • 2011-07-03
    • 2019-08-29
    • 2020-12-12
    • 2018-04-22
    • 2021-07-29
    • 2018-07-08
    • 1970-01-01
    相关资源
    最近更新 更多