gitbutler
gitbutler copied to clipboard
Remote commits are not pulled, causing the danger of overwriting them with local commits
There is currently a way to overwrite the remote commits without knowing.
To repro:
- Ensure "Allow force pushing" is not selected in the GitButler's project settings
- Make a new virtual branch
- Make a commit
test 1
, push the branch and make a PR - In Github, open the PR and edit a file on the branch, and commit it with
test 2
- Make a commit locally and call it
test 3
. - Force push the changes - even though "allow force pushing" is not enabled.
- Notice that the
test 2
commit was overwritten.
This is quite dangerous in a situation where you contribute with other developers on the same branch as you can easily overwrite their work without knowing.
This issue is the result of this thread on Discord.
I think this is an even broader problem which is a deal breaker when using the tool: the inability of merging remote changes to the matching virtual branch. This happens all the time when there are at least 2 developers working on the same feature branch :/
☝🏼 I have been wondering about this myself. :) From reading the documentation the expected workflow in this case would be to create a new "trunk" branch which is the "base branch" shared with other developers and then use PRs against this base branch. This should work fine, but it is somewhat an hassle not being able to use pull the changes in any way, but at the same time I understand that this would be problematic to integrate, because then you are updating only the "virtual branch" instead of the "base".
I hope my understanding&explanation is correct and makes sense. 😅
We're making some progress e.g. here, but it's hidden since we need to refactor the Rust code that is meant to merge in upstream changes.
Once we have this working again we can build a --force-with-lease
like flag to prevent accidentally overwriting commits pushed by others!