GitHub分支始终不同步,尽管它们应该同步。

huangapple go评论96阅读模式
英文:

Github branches never in sync even though they should be

问题

I have two branches staging and master. They are in sync no differences.

Using github.com I follow these steps.

  1. I create a new branch called Tim
  2. make edits
  3. commit edits to that branch Tim I just made
  4. merge that Tim to the staging
  5. merge staging into master

After step 5, I go to the staging branch and it says it's out of sync with the master branch, master branch is ahead by one commit.
I look to see what was changed and it was the staging merge.
If I sync master to staging, then master says it's behind one commit and the cycle never ends, they don't ever sync.

What am I doing wrong? I have a video showing this if it's helpful.

英文:

I have two branches staging and master. They are in sync no differences.

Using github.com I follow these steps.

  1. I create a new branch called Tim
  2. make edits
  3. commit edits to that branch Tim I just made
  4. merge that Tim to the staging
  5. merge staging into master

After step 5, I go to the staging branch and it says it's out of sync with the master branch, master branch is ahead by one commit.
I look to see what was changed and it was the staging merge.
If I sync master to staging, then master says it's behind one commit and the cycle never ends, they don't ever sync.

What am I doing wrong? I have a video showing this if it's helpful
GitHub分支始终不同步,尽管它们应该同步。
GitHub分支始终不同步,尽管它们应该同步。
GitHub分支始终不同步,尽管它们应该同步。
GitHub分支始终不同步,尽管它们应该同步。

答案1

得分: 2

"即使他们应该" 不,他们不应该。这不是 "合并" 的意思。

如果你有这种情况:

A -- B -- C <- 主分支
 \
   --- X -- Y <- 暂存分支

然后如果你将 暂存分支 合并到 主分支,你会得到这个结果:

A -- B -- C -- M <- 主分支
 \            /
   --- X -- Y <- 暂存分支

正如你可以看到的,现在有一个新的提交 M — 合并提交。它在 主分支 上,但不在 暂存分支 上。所以 主分支 领先 1 步。这正是你(应该)期望的。

英文:

"even though they should be" No, they shouldn't. That's not what "merge" means.

If you have this situation:

A -- B -- C &lt;- master
 \
   --- X -- Y &lt;- staging

Then if you merge staging into master, you have this:

A -- B -- C -- M &lt;- master
 \            /
   --- X -- Y &lt;- staging

As you can see, there is now a new commit M — the merge commit. And it is on master but not on staging. So master is ahead by 1. And that is exactly what you (should) expect.

huangapple
  • 本文由 发表于 2023年8月5日 01:19:42
  • 转载请务必保留本文链接:https://go.coder-hub.com/76838007.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定