How can I save git "rebase in progress"?

I am in the middle of a big “perestroika” with many conflicts.

I would like to postpone this progress and try to solve this problem using a different approach.

Is there a way to save the current call forwarding so that I can complete it later?

+4
source share
2 answers

If you are sitting in a conflicting merge as part of a rebase, you are kind of stuck. That is why, how and what you can do.

Rebase = Cherry Picker

Basically, a redirect operation in Git is just a series of sweet cherry operations. Let's start with something like this:

...--A1--A2--A3--A4--A5   <-- branchA
          \
           B1--B2--B3   <-- branchB

and we want to end up with:

...--A1--A2--A3--A4--A5   <-- branchA
          \           \
           \           B1'-B2'-B3'  <-- branchB
            \
             B1--B2--B3   [abandoned]

, ( Git) , - git cherry-pick - commit B1 ( ) A5, B2, B1' ..

git cherry-pick "", . rebase , git cherry-pick.

, , Git . . rebase. , , "" , Git , , rebase. Git , Git rebase .

, , Git - , . , README, file otherfile, .

, , , Gitty. , , - .., Git . ( , , rebase.)

. , . , ( ), . 1-3, , , . 1 ( ), "" --ours --theirs "remote" . - , , git add . - , 1-3 . .


1 , 0 , 1-3 , 0 1-3. , 1, 2 / 3 , , / /, "0 , 1-3 ", .


, , . .

( "the" ) , , , , , ( ).

, , git add / git commit , . , Git , : 1-3 , Git , .

- ; .git/index . - "", - . ( , Git "" , "" , . Git .)

, , , . , , : .

, " B", , B2, . :

...--A1--A2--A3--A4--A5   <-- branchA
          \           \
           \           B1'  <-- HEAD
            \
             B1--B2--B3   <-- branchB

. " ": Git . HEAD .

, ( , ) , , , ( ), git commit commit B2':

...--A1--A2--A3--A4--A5   <-- branchA
          \           \
           \           B1'-B2'  <-- HEAD
            \
             B1--B2--B3   <-- branchB

- , , git commit. , , HEAD :

$ git branch saveme    # or git tag saveme

:

...--A1--A2--A3--A4--A5   <-- branchA
          \           \
           \           B1'-B2'  <-- HEAD, saveme
            \
             B1--B2--B3   <-- branchB

:

$ git rebase --abort

Git branchB:

...--A1--A2--A3--A4--A5   <-- branchA
          \           \
           \           B1'-B2'  <-- saveme
            \
             B1--B2--B3   <-- HEAD->branchB

, , . ( Git) B1', commit B2', , . commits saveme~1 saveme, ; saveme, .

+5

, , :

, reba-as-is.

+1

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


All Articles