【问题标题】:How can I "force" a git rebase?我怎样才能“强制”一个 git rebase?
【发布时间】:2017-05-13 06:06:45
【问题描述】:

当前分支是myBranch,它落后于master 2次提交。我想重新设置它,所以我尝试了

$ git rebase master

Current branch myBranch is up to date.


$ git push --set-upstream origin myBranch

Branch myBranch set up to track remote branch myBranch from origin.
Everything up-to-date

似乎我尝试的一切,我都得到“它是最新的”

有人遇到这种情况吗?

【问题讨论】:

  • 你如何确定分支是'2次提交在master之后'。如果远程master 分支包含更多提交,请查看this post 以获取有关如何更新分支的说明
  • 确定它落后了吗?当你执行git fetch 时会发生什么?
  • 听起来myBranch 不在master 后面。尝试做git rev-parse mastergit merge-base myBranch master。如果这两个命令产生相同的 SHA-1,则 myBranch 不在 master 后面。
  • 我看到当前分支在我分叉存储库的站点上的 master 后面。有 请求将 marian-ald:cabal 合并到 master(后面 2 个提交),其中 cabal 是分支名称。
  • 我得到了相同的 SHA-1。看来你是对的。我想知道为什么在我看到我的分支的网页上它是 master 后面的 2 提交。 :(link

标签: git github rebase master


【解决方案1】:

请检查“git remote -v”并检查 Origin 。如果未设置,请将原点设置为主并再次变基

【讨论】:

  • 我在 git remote -v 得到这个:origin git@gitlab.com:marian-ald/package_manager.git (fetch) origin git@gitlab.com :marian-ald/package_manager.git (推送)
  • 从上面的 cmets 看来这不是问题,所以你找到了你要找的东西吗?还是问题悬而未决?
  • 这是一个令人困惑的答案,因为您不能将 remote origin 设置为 master 分支。
【解决方案2】:

尝试使用git rebase origin/master

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2013-02-08
  • 1970-01-01
  • 2016-11-25
  • 1970-01-01
  • 2010-11-17
  • 1970-01-01
  • 1970-01-01
  • 2011-07-27
相关资源
最近更新 更多