【问题标题】:Meaning of this git command's log这个 git 命令的日志的含义
【发布时间】:2023-04-09 23:46:01
【问题描述】:

我在我的存储库上做了一个 git fetch origin。 我有兴趣在名为 search-analytics 的远程分支上进行开发

在命令的输出中我看到了

+ 5c2e2aa...e9ad142 search-analytics -> origin/search-analytics  (forced update)

这里的(强制更新)是什么意思?这不会出现在任何其他分支上。

【问题讨论】:

    标签: git


    【解决方案1】:

    我认为那条线表示有人执行了强制推送,强制推送发生如下:

    # Change example.file
    git add example.file
    git commit example.file -m "I'm commiting this file"
    git push origin search-analytics
    # Realize you screwed something up and don't want anyone to see it
    # Change example.file again, or any file really
    git add example.file
    git commit --amend
    # Amends the previous commit, as if the changes you just made, 
    #                                        were originally in it
    git push origin search-analytics
    # The push fails because you amended a commit you already pushed
    git push origin search-analytics --force
    

    如果您在强制合并后遇到问题(即您在两次推送之间拉入),here 解释了如何重置您的分支(几乎是唯一的解决方案)

    【讨论】:

    • 这与 OP 中来自git fetch 的消息有何关系?
    • 有人做了我上面解释的事情,这就是为什么它会载入史册
    【解决方案2】:

    这意味着删除分支 (origin/search-analytics) 的更新方式会撤消您已经从中提取的一些提交。 换句话说,您正在处理的先前版本不仅已更新(即,在其之上添加了更多提交),而且其中一个或多个已被删除/重做。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多