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

git-imerge: update for the latest version #8118

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions pages/common/git-imerge.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# git-imerge

> Perform a merge or rebase between two Git branches incrementally.
> Perform an incremental merge or rebase between two Git branches.
> Conflicts between branches are tracked down to pairs of individual commits, to simplify conflict resolution.
> More information: <https://github.com/mhagger/git-imerge>.

- Start imerge-based rebase (checkout the branch to be rebased, first):

`git imerge rebase {{branch_to_rebase_onto}}`
`git-imerge rebase {{branch_to_rebase_onto}}`

- Start imerge-based merge (checkout the branch to merge into, first):

`git imerge merge {{branch_to_be_merged}}`
`git-imerge merge {{branch_to_be_merged}}`

- Show ASCII diagram of in-progress merge or rebase:

`git imerge diagram`
`git-imerge diagram`

- Continue imerge operation after resolving conflicts (`git add` the conflicted files, first):

`git imerge continue --no-edit`
`git-imerge continue`

- Wrap up imerge operation, after all conflicts are resolved:
- Finish a merge or a rebase, after all conflicts are resolved:

`git imerge finish`
`git-imerge finish`

- Abort imerge operation, and return to the previous branch:
- Abort imerge operation and clean up temporary commits:

`git-imerge remove && git checkout {{previous_branch}}`
`git-imerge remove`
Comment on lines +27 to +29
Copy link
Member

@waldyrious waldyrious Jun 7, 2022

Choose a reason for hiding this comment

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

Hmm, I disagree with this change. The first part of the sentence ("Abort imerge operation") already refers to the cleaning up of the temporary commits. I don't think we need to specify that detail, especially since there's no mention of temporary commits before this.

In the same vein, I think it is better to keep the second part of the sentence and command, i.e. the extra step of returning to the original branch, as otherwise users would be left in a detached HEAD state. This is in fact recommended in the tool's documentation.

There are two issues for implementing a proper imerge-aborting subcommand (mhagger/git-imerge#123 and mhagger/git-imerge#189) but until then, this should not be presented stand-alone as if it were a fully supported operation of the git-imerge tool — it's more like plumbing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe replace that with git rebase --abort? If I remember correctly, it returns to the original branch automatically.

There are some things I need to do before I can check and confirm the behavior.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think git rebase --abort would work; IIUC, the imerge operations aren't registered by git as a regular rebase. But do test and let us know :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I haven't used the merge capability, only rebase, and right now I don't have any PRs that need conflict resolution to test this. Looks like writing tests https://github.com/mhagger/git-imerge/tree/master/t would take a few hours, and I need them to complete other things.

Basically the testing plan.

  1. start rebase on a conflicting branch
  2. wait for terminal drop out for conflict resolution
  3. use remove and see if git switched back to conflicting
  4. check if temp branch is still there
  1. start merge on a conflicting branch
  2. wait for terminal drop out for conflict resolution
  3. use remove and see if git switched back to conflicting
  4. check if temp branch is still there
  1. start rebase on a conflicting branch
  2. wait for terminal drop out for conflict resolution
  3. use git rebase --abort and see if git switched back to conflicting
  4. check if temp branch is still there
  1. start merge on a conflicting branch
  2. wait for terminal drop out for conflict resolution
  3. use git merge --abort and see if git switched back to conflicting
  4. check if temp branch is still there

Copy link
Member

Choose a reason for hiding this comment

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

Tests for imerge would be awesome! Alternatively, in case writing the tests proves too burnensome, @mhagger himself could confirm whether git rebase --abort is a viable alternative to manually git checkouting (or git switching) to the previous branch.