B
B
BonBon Slick2020-05-11 14:04:09
git
BonBon Slick, 2020-05-11 14:04:09

What is the correct way to rebase?

rebase overwrites all local changes with new ones.
The fact is that all files in which there are conflicts must be manually merged.
Options such as

-X
--strategy-option=
Pass the through to the merge strategy. This implies --merge and, if no strategy has been specified, -s recursive. Note the reversal of ours and theirs as noted above for the -m option.

See also INCOMPATIBLE OPTIONS below.

Do not work, at least as described, namely
[email protected]:/var/www/event-app-v3$ git rebase -Xours origin/develop 
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to origin/develop.

[email protected]:/var/www/event-app-v3$ git reset --hard b402408
HEAD is now at b402408 improvements 8

[email protected]:/var/www/event-app-v3$ git rebase -Xtheirs origin/develop 
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to origin/develop.
[email protected]:/var/www/event-app-v3$ git reset --hard b402408
HEAD is now at b402408 improvements 8

[email protected]:/var/www/event-app-v3$ git rebase --strategy-option=ours origin/develop 
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to origin/develop.

[email protected]:/var/www/event-app-v3$ git reset --hard b402408
HEAD is now at b402408 improvements 8

[email protected]:/var/www/event-app-v3$ git rebase --strategy-option=theirs origin/develop 
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to origin/develop.

[email protected]:/var/www/event-app-v3$ git reset --hard b402408
HEAD is now at b402408 improvements 8
[email protected]:/var/www/event-app-v3$


All the examples above, the code from the develop branch overwrites all local changes and because of this did a reset --hard.
But even if they worked, all the same, the extremes, either ours or theirs, do not fit. both locally and on remote branches have the necessary code.

The --onto option is also not suitable, because it is equivalent to
The current branch is reset to , or if the --onto option was supplied. This has the exact same effect as git reset --hard (or ). ORIG_HEAD is set to point at the tip of the branch before the reset.

[email protected]:/var/www/event-app-v3$ git rebase --onto speaker-attendee-ui develop 
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to speaker-attendee-ui.

[email protected]:/var/www/event-app-v3$ git reset --hard b402408
HEAD is now at b402408 improvements 8

[email protected]:/var/www/event-app-v3$ git rebase --onto develop speaker-attendee-ui
First, rewinding head to replay your work on top of it...
Fast-forwarded speaker-attendee-ui to develop.

In the first team, the edits of the local old branch were applied on top of develop, in the 3rd develop, on top of locally.

I don't see the manual merge option in the dock.

It is worth mentioning that the local branch has already been merged with develop.
That is, a commit, push and merge has already been made with the develop branch. As I understand it, git treats updates from develop as updates and not conflicts , so it overwrites local, old data.

The situation arose as a result of the fact that another developer overwrote, broke the working functional, and now, in order to restore, it is necessary to merge into the old working branch of the feature with hundreds of updates, commits from the develop branch.
I had to search for and restore the branch and actually do exactly the rebase. merge will pull a lot of commits with it. By the way, the merge seems to work the same way, it overwrites everything in the local branch.

So how do you manually merge all conflicts on rebase?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BonBon Slick, 2020-05-11
@BonBonSlick

The only option I came up with is manually comparing files using special tools like GitG, PhpStorm git plugin or the manual git -diff
command. These commands do not work correctly with any options like --onto or -X because there are no conflicts.
merge / rebase / pull
I suspect this is because the branch was already merged earlier with develop

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question