-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make rebase smarter when handling PRs with merges #183
Make rebase smarter when handling PRs with merges #183
Conversation
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
8aa88b8
to
a7346ce
Compare
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
Updated. The implementation was a bit more complicated than expected, but it seems to work with a simple test. More testing is extremely welcome. A lot of messages still say rebasing instead of merging when merging is used (although technically if a merge is detected, then this is a NOP, is just pushing the HEAD of the PR as the new BASE). I'm not sure if it's needed to change the wording, as conceptually we are doing a "rebase" (even when it won't be one). |
a7346ce
to
04c834a
Compare
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
I would merge this and make it part of an alpha release so we can get more people to try it out without having to install the script manually from the devel repo. |
04c834a
to
ce19661
Compare
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
starting = args.action is None | ||
try: | ||
if starting: | ||
# Last commit is a merge commit, so ask the user to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really ask user to do anything?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I moved the question to an earlier stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it is here, but this comment is outdated then: https://github.com/sociomantic-tsunami/git-hub/pull/183/files#diff-88fb15e32f4101f90004ef18b66b704bR1800
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes sociomantic-tsunami#183.
ce19661
to
459959e
Compare
If the HEAD of the PR is a merge commit (has more than 1 parent), ask the user if they would like to do a `merge --ff-only` instead, as normally rebasing a merge commit results in horrors and nightmares. This feature should be considered experimental, in the future this might be done by default without asking or an option might be added to force this behaviour beforehand to avoid annoying interactive questions. Fixes #183.
When maintaining multiple branches is common to apply bug fixes in old branches and then merge the old branches in newer ones. If a PR is created for those merges,
git hub rebase
will fail miserably at trying to rebase the PR with a merge.For this reason it could be good to detect merges in PRs when doing a
git hub rebase
and offer the user to do agit merge --ff-only
instead of a rebase, which is usually what you want to do for that kind of PRs.