Skip to content
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

Conversation

leandro-lucarella-sociomantic
Copy link
Contributor

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 a git merge --ff-only instead of a rebase, which is usually what you want to do for that kind of PRs.

@leandro-lucarella-sociomantic leandro-lucarella-sociomantic added this to the v0.11 milestone May 26, 2016
leandro-lucarella-sociomantic added a commit to leandro-lucarella-sociomantic/git-hub that referenced this pull request Sep 6, 2016
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.
leandro-lucarella-sociomantic added a commit to leandro-lucarella-sociomantic/git-hub that referenced this pull request Sep 12, 2016
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.
@leandro-lucarella-sociomantic
Copy link
Contributor Author

leandro-lucarella-sociomantic commented Sep 12, 2016

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).

leandro-lucarella-sociomantic added a commit to leandro-lucarella-sociomantic/git-hub that referenced this pull request Sep 14, 2016
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.
@leandro-lucarella-sociomantic
Copy link
Contributor Author

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.

leandro-lucarella-sociomantic added a commit to leandro-lucarella-sociomantic/git-hub that referenced this pull request Sep 27, 2016
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.
leandro-lucarella-sociomantic added a commit to leandro-lucarella-sociomantic/git-hub that referenced this pull request Sep 27, 2016
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
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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.
nemanja-boric-sociomantic pushed a commit that referenced this pull request Sep 27, 2016
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.
@nemanja-boric-sociomantic
Copy link
Contributor

This pull request has been rebased via git hub pull rebase. Original pull request HEAD was 459959e, new (rebased) HEAD is 74aca37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants