Skip to content

Conversation

thegeneralist01
Copy link

Add a "force pull" command. This is rather just a normal pull with merge strategy --strategy-option=theirs, meaning it will automatically resolve merge conflicts with the remote's changes.

This PR and #933 address the following issues:
Closes #702
Closes #872
Closes #906
Partially addresses #920

@Vinzent03
Copy link
Owner

Vinzent03 commented Jun 30, 2025

Why are you including a packaged isomorphic-git version without documenting what you have changed? This is similar to how one would do a supply chain attack! I've checked some diff now of the generated files and they seem fine, but please create a pr to isomorphic-git first. Also, don't change config values of esbuild.

@thegeneralist01
Copy link
Author

This is similar to how one would do a supply chain attack!

Hahahah, sorry. I didn't even think of that perspective.

As for why, it's because I added the merge strategies (only "ours" and "theirs") into the code - https://github.com/thegeneralist01/isomorphic-git/tree/merge-strategies. I didn't even think of submitting a PR to isomorphic-git, because there are more strategies and implementing only two would mean that the feature is half-baked.

The correct SHA-1 hash after npm pack of the archive should be 511e83a8bdca027c901cbdf62c1a3865d3d7e45b, which you can check for e4094b1 and try yourself at the branch mentioned above.

@thegeneralist01
Copy link
Author

thegeneralist01 commented Jun 30, 2025

PS: just realized one could pin the package. In our case, that would be: git+https://[email protected]:thegeneralist01/isomorphic-git.git#d74e625fe70b883b3decb34e39685796d478babc for thegeneralist01/isomorphic-git@d74e625. Tell me what you think

@thegeneralist01
Copy link
Author

thegeneralist01 commented Jun 30, 2025

but please create a pr to isomorphic-git first

completely missed this. Will do, thanks

@thegeneralist01
Copy link
Author

but please create a pr to isomorphic-git first

No need to do so actually. Completely missed the mergeDriver property for merge()

@thegeneralist01
Copy link
Author

sorry, I didn't make this clear before - the PR can be reviewed now

Copy link
Owner

@Vinzent03 Vinzent03 left a comment

Choose a reason for hiding this comment

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

I think it would also be great to add an option in the settings to set the strategy option (default, ours, theirs) permanently and therefore use that strategy for automatic sync as well.

- Integrate force param into pullChangesFromRemote
- Get rid of the vendored package, use existing mergeDriver
- Revert the "force pull" code and terminology
- Add conflict resolution strategies to settings
@thegeneralist01 thegeneralist01 force-pushed the feat/force-pull branch 2 times, most recently from d6e31bd to 0d3bbd2 Compare August 31, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: git mobile is unable to resolve merge conflicts Auto-merge option to prioritize remote changes [Feature]: Force pull / reset --hard HEAD
3 participants