rebase push 会去branch A or branch B
rebase push will go to branch A or branch B
更新1:
现在我在做 rebase 时遇到了冲突。在我修改代码之后。你能告诉我要执行什么命令来消除冲突吗?
提供以下状态
sports/code/file (branchB)
$ git pull --rebase origin branchA
From https://gitlab.sports.com
* branch branchA -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: wip html fixes
Using index info to reconstruct a base tree...
M sports/ajax.js
Falling back to patching base and 3-way merge...
Auto-merging sports/ajax.js
CONFLICT (content): Merge conflict in sports/ajax.js
error: Failed to merge in the changes.
Patch failed at 0001 wip html fixes
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
sports/code/file (branchB|REBASE 1/2)
$ git status
rebase in progress; onto 89898989892323
You are currently rebasing branch 'branchB' on '89898989892323'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: sports/ajax.js
no changes added to commit (use "git add" and/or "git commit -a")
- 我正在努力学习 rebase。
- 我有一个从 develop 分支创建的分支 A,
- 我从分支 A 创建了一个新的本地分支 B。
- 我使用此命令
git pull --rebase origin A
进行了 git 变基
- 不,如果我这样做
git push -f origin B
我的代码会单独进入分支 B 还是也会进入分支 A。
- 如果我在分支 B 中键入 git 状态,我会看到以下消息。
- 我关注了这个媒体 link https://medium.com/@gitaumoses4/git-rebase-a-tool-for-excellent-git-workflow-3aaa1bba40a4
- 你能告诉我如何修复它,以便将来我可以自己解决
$ git status
On branch B
Your branch and 'origin/B' have diverged,
and have 7 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
From the branch A I created a new local branch B.
a--a--a (A)
\
b (B, origin/B, meaning this is the initial commit pushed to the remote repo)
Now, if I do git push -f origin B
, will my code go into branch B
alone or will it go into branch A
also.
单独分支 B,但分支 B 将包含分支 A 提交。
那是因为,当您这样做时:
git checkout B
git pull --rebase origin A
你从
a--a--a--a--a--a (A)
\
b--B--B--B--B--B (local work B)
^
(origin/B)
收件人:
(A)
v
a--a--a--a--a--a--b'--B'--B'--B'--B'--B' (new rebased B work, on top of A)
\
b
(still origin/B)
这就是你看到的原因:
Your branch and 'origin/B' have diverged,
and have 7 and 1 different commits each, respectively.
在你的情况下,如果 git status
显示你正在使用 B,你可以
git push --force
您将获得:
a--a--a--a--a--a--b'--B'--B'--B'--B'--B' (B, origin/B)
您的分支 B 现在包含来自 A 的提交,但分支 A 保持不变。
更新1:
现在我在做 rebase 时遇到了冲突。在我修改代码之后。你能告诉我要执行什么命令来消除冲突吗? 提供以下状态
sports/code/file (branchB)
$ git pull --rebase origin branchA
From https://gitlab.sports.com
* branch branchA -> FETCH_HEAD
First, rewinding head to replay your work on top of it...
Applying: wip html fixes
Using index info to reconstruct a base tree...
M sports/ajax.js
Falling back to patching base and 3-way merge...
Auto-merging sports/ajax.js
CONFLICT (content): Merge conflict in sports/ajax.js
error: Failed to merge in the changes.
Patch failed at 0001 wip html fixes
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".
sports/code/file (branchB|REBASE 1/2)
$ git status
rebase in progress; onto 89898989892323
You are currently rebasing branch 'branchB' on '89898989892323'.
(fix conflicts and then run "git rebase --continue")
(use "git rebase --skip" to skip this patch)
(use "git rebase --abort" to check out the original branch)
Unmerged paths:
(use "git reset HEAD <file>..." to unstage)
(use "git add <file>..." to mark resolution)
both modified: sports/ajax.js
no changes added to commit (use "git add" and/or "git commit -a")
- 我正在努力学习 rebase。
- 我有一个从 develop 分支创建的分支 A,
- 我从分支 A 创建了一个新的本地分支 B。
- 我使用此命令
git pull --rebase origin A
进行了 git 变基
- 不,如果我这样做
git push -f origin B
我的代码会单独进入分支 B 还是也会进入分支 A。 - 如果我在分支 B 中键入 git 状态,我会看到以下消息。
- 我关注了这个媒体 link https://medium.com/@gitaumoses4/git-rebase-a-tool-for-excellent-git-workflow-3aaa1bba40a4
- 你能告诉我如何修复它,以便将来我可以自己解决
$ git status
On branch B
Your branch and 'origin/B' have diverged,
and have 7 and 1 different commits each, respectively.
(use "git pull" to merge the remote branch into yours)
nothing to commit, working directory clean
From the branch A I created a new local branch B.
a--a--a (A)
\
b (B, origin/B, meaning this is the initial commit pushed to the remote repo)
Now, if I do
git push -f origin B
, will my code go into branchB
alone or will it go into branchA
also.
单独分支 B,但分支 B 将包含分支 A 提交。
那是因为,当您这样做时:
git checkout B
git pull --rebase origin A
你从
a--a--a--a--a--a (A)
\
b--B--B--B--B--B (local work B)
^
(origin/B)
收件人:
(A)
v
a--a--a--a--a--a--b'--B'--B'--B'--B'--B' (new rebased B work, on top of A)
\
b
(still origin/B)
这就是你看到的原因:
Your branch and 'origin/B' have diverged, and have 7 and 1 different commits each, respectively.
在你的情况下,如果 git status
显示你正在使用 B,你可以
git push --force
您将获得:
a--a--a--a--a--a--b'--B'--B'--B'--B'--B' (B, origin/B)
您的分支 B 现在包含来自 A 的提交,但分支 A 保持不变。