gitbutlerapp / gitbutler

The GitButler version control client, backed by Git, powered by Tauri/Rust/Svelte
https://gitbutler.com
Other
13.29k stars 528 forks source link

Merge and rebase duplicates commit history and prevents subsequent pull requests #5501

Open leokeba opened 1 week ago

leokeba commented 1 week ago

Version

0.13.13

Operating System

macOS

Distribution Method

dmg (Apple Silicon)

Describe the issue

When merging a branch using the "Merge and rebase" method, updating the workspace in GitButler doesn't work as expected. Instead of matching the remote commits with the local ones, they appear on top of the local workspace as though they were different commits. I suspect this happens because github re-hashes every commit when doing the rebase.

If I commit again on the same branch (after updating my workspace) and try to make a PR, this creates all sorts of issues. Sometimes I get merge conflicts on github (but GB doesn't see them), and if I can merge the PR and update my workspace again, the following PR stays "on top" of the commit history (meaning every new commit lands "under" it instead of on top) and prevents me from creating subsequent ones.

All of this does not happen if I discard the merged branch and create a new one. However, if I want to keep the same name (like "dev"), I have to manually delete both local and remote branches before recreating it. This is quite annoying and very error-prone.

How to reproduce

Expected behavior

GitButler should match the local commits with the ones upstream and deduplicate them somehow. Basically this should work the same as when doing a regular merge, i.e. just having to update the local workspace and being able to start working again on the same branch immediately without experiencing these issues.

Relevant log output

No response

Byron commented 1 week ago

Thanks a lot for reporting!

I admit that this is way over my head right now, but maybe @Caleb-T-Owens could help out much more easily here. Thanks everyone.