英文:
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.
- I create a new branch called
Tim
- make edits
- commit edits to that branch
Tim
I just made - merge that
Tim
to thestaging
- merge
staging
intomaster
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.
- I create a new branch called
Tim
- make edits
- commit edits to that branch
Tim
I just made - merge that
Tim
to thestaging
- merge
staging
intomaster
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
答案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 <- master
\
--- X -- Y <- staging
Then if you merge staging
into master
, you have this:
A -- B -- C -- M <- master
\ /
--- X -- Y <- 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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论