push rebase пойдет в ветку A или ветку B - PullRequest
0 голосов
/ 17 мая 2019

update1:

сейчас я сталкиваюсь с конфликтами, когда делаю ребазинг. после того, как я изменю код. Можете ли вы дать мне знать, какую команду выполнить для устранения конфликтов. Предоставление статуса ниже

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")
  • Я пытаюсь выучить ребаз.
  • У меня есть ветвь A, которая создана из ветки разработки,
  • из ветви A Я создал новую локальную ветку B.
  • я сделал git rebase, используя эту команду git pull --rebase origin A
  • нет, если я сделаю git push -f origin B пойдет ли мой код только в ветку B или в ветку A.
  • если я набираю git status в ветке B, я вижу следующее сообщение.
  • я перешел по этой средней ссылке 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

1 Ответ

0 голосов
/ 18 мая 2019

Из ветви A я создал новую локальную ветку B.

a--a--a (A)
       \
        b (B, origin/B, meaning this is the initial commit pushed to the remote repo)

Теперь, если я сделаю git push -f origin B, мой код пойдет только в ветку B или также в ветку A.

Одна ветвь 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 остается неизменной.

...