After git rebase, my local branch and remote branch diverge

I have a branch my-featurethat is reset to check the code. It is not used . In the end, it will be merged with my branch develop, which is publicly available among my team. I would like to reinstall the branch developin my-featureto keep clearing the history, and then combine the branch of my function into development. This is what I did:

$ git checkout my-feature
// do some work. make commits.

$ git rebase develop
// fix some conflicts

$ git add .

$ git rebase --continue

After successfully restoring the database, I check the status:

$ git status
On branch my-feature
Your branch and 'origin/my-feature' have diverged,
and have 155 and 1 different commit each, respectively.
  (use "git pull" to merge the remote branch into yours)

$ git what do I do here?

, . git pull, , , . , , . ? ?

+4
3

-, git push --force - : , .
.

-, , (origin/xxx)

git rebase develop

d--d--d (develop)
    \
     x--x--x--x--x--X--y--y--y (my-feature)
                    |
       (origin/my-feature)   

X / , , my-feature).
git - :

On branch my-feature
Your branch is ahead of 'origin/my-feature' by 3 commit.

develop, my-feature HEAD

        X--X--X--X--X--X--Y--Y--Y  (my-feature)
       /
d--D--d (develop)
    \
     x--x--x--x--x--X
                    |
       (origin/my-feature)   

my-feature origin/my-feature , my-feature, develop! (D )

,

Your branch and 'origin/my-feature' have diverged,
and have 155 and 1 different commit each, respectively.

, git push --force origin my-feature :

        X--X--X--X--X--X--Y--Y--Y  (my-feature, origin/my-feature)
       /
d--D--d (develop)

( my-feature , a git push --force , default push push.default simple. < > , git rev-parse --abbrev-ref --symbolic-full-name @{u})

+7

, , , my-feature origin/my-feature (, , ), my-feature ( ), rebase.

rebase, , --force . , , - , .

, . - . , rebase, .

+2

, git -commit-structure:

A--B--C--D--E(origin/my-feature)
 \
  F--G--H--I(someotherbranch)

origin/my-feature someotherbranch, :

A--B--C--D--E(origin/my-feature)
 \
  F--G--H--I(someotherbranch)
            \
             B'--C'--D'--E'(my-feature)

diverging. my-feature , origin/my-feature, fast-forward . origin/my-feature -, push -f. - , , . , , origin/my-feature, .

: rebase .

:

              J--K--G(origin/otherperson)
             /
A--B--C--D--E(origin/my-feature)
 \
  F--G--H--I(someotherbranch)
            \
             B'--C'--D'--E'(my-feature)

:

A--B--C--D--E(origin/my-feature) (orphaned if push-f)
 \
  F--G--H--I(someotherbranch)
            \
             \               J'--K'--G'(origin/otherperson)
              \             /
               B'--C'--D'--E'(my-feature)
+1

Source: https://habr.com/ru/post/1616639/


All Articles