【问题标题】:git: Pushing changes in particular commitgit:在特定提交中推送更改
【发布时间】:2014-11-28 07:35:44
【问题描述】:

我已经检查了特定的提交:

git checkout xx
#made changes
...
git add .
git commit -m "abcd"
git push

但我在 github 网站上没有看到任何更新。
请帮助我成功推送到我的分叉仓库。

【问题讨论】:

    标签: git github


    【解决方案1】:

    您已签出提交而不是分支:您处于分离的 HEAD 模式,git push 拒绝推送分离的头。
    见“Why did my Git repo enter a detached HEAD state?”

    您需要根据当前提交创建一个新分支,或者在该提交上重置一个现有分支。
    见“git: switch branch without detaching head”。

    一旦您的提交被分支引用(如git branch 命令所示),您将能够将该分支推送到您的远程仓库。


    注意:使用 Git 2.23(2019 年 8 月),您可以使用 git restore 和 update your working tree 分离 HEAD(因为您不切换分支)。
    要切换分支,您现在拥有(同样是 Git 2.23)git switch。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-28
      • 2014-07-13
      • 2016-07-06
      • 2021-05-31
      • 2013-02-13
      • 2013-06-09
      • 2011-06-29
      • 1970-01-01
      相关资源
      最近更新 更多