Only for merging in Rebase / Replay

Is there a way to automatically overload a large number of merge commands? The answers to another question are suggested to be used by the Rebasing Git merge commit--preserve-merges , but this will also lead to a permutation of fuzzy commits.

This behavior is undesirable when merging function branches into a master or integration branch, and then discovering that someone else has just pushed the changes. In addition, it is useful to be able to reinstall the development branch to a new command commit, or remove fixes from the development that will not be used.

For example, given the following situation:

* 7909b1a (origin/master) Merge bug/456
|\
| * f9d43b6 (origin/bug/456) 456 - Change color
|/
| * 32666f3 (HEAD, master) Merge branch 'bug/123'
| |\
|/ /
| * 0939652 (origin/bug/123, bug/123) 123 - Fix Spelling
|/
o 96c9aa9 (tag: v1.1.1)

If I run git rebase --preserve-merges origin/master, this will result in the following:

* (HEAD, master) Merge branch 'bug/123'
|\
| * 8e6ccbe 123 - Fix Spelling
|/
* 7909b1a (origin/master) Merge bug/456
|\
| * f9d43b6 (origin/bug/456) 456 - Change color
|/
| * 32666f3 (ORIG_HEAD) Merge branch 'bug/123'
| |\
|/ /
| * 0939652 (origin/bug/123, bug/123) 123 - Fix Spelling
|/
o 96c9aa9 (tag: v1.1.1)

, commit 0939652 , public repos, . :

* 710c5d7 (HEAD, master) Merge branch 'bug/123'
|\
| * 0939652 (origin/bug/123, bug/123) 123 - Fix Spelling
* |   7909b1a (origin/master) Merge bug/456
|\ \
| |/
|/|
| * f9d43b6 (origin/bug/456) 456 - Change color
|/
o 96c9aa9 (tag: v1.1.1)

reset --hard /, , ( - rerere-autoupdate, ), , 15 1.

Git script, , ?

, git rebase -ip master, .

error: Commit 00... is a merge but no -m option was given.
fatal: cherry-pick failed
Could not pick 00...
+4
1

, , .

git checkout -B master origin/master
git merge bug/123

, 32666. rebase - , .

-1

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


All Articles