Skip to content

Conversation

@thegeneralist01
Copy link
Contributor

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
Contributor 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
Contributor 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
Contributor Author

thegeneralist01 commented Jun 30, 2025

but please create a pr to isomorphic-git first

completely missed this. Will do, thanks

@thegeneralist01
Copy link
Contributor 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
Contributor 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
@thegeneralist01
Copy link
Contributor Author

@Vinzent03 Hi, this is ready for your review when you get a chance. Totally understand if you’re busy in real life -- just wanted to flag it so it’s on your radar. Thanks

@k9ur
Copy link

k9ur commented Oct 15, 2025

Any updates @Vinzent03?

@thegeneralist01
Copy link
Contributor Author

thegeneralist01 commented Nov 6, 2025

For anyone waiting, a better workaround would be to use a Git client.

I use GitSync (mentioned in the README of this repo) on my iOS devices -- it is also completely free.

Edit: Note that it also removes the need for this plugin.

@epanonymous
Copy link

@Vinzent03 any blockers for merging this?

@idohalamit
Copy link

@Vinzent03 what can I do for this to merge? I'm dying for this feature

@Vinzent03
Copy link
Owner

I finally took the time to make a review of this pr. I've commented on many changes, which I've resolved now myself. I also renamed the setting id and type to MergeStrategy.
This pr now only exposes the setting and no extra command, but I think thats actually better. Also helps to not provide too many commands.
Are there any remaining comments or can this be merged?

@thegeneralist01
Copy link
Contributor Author

I finally took the time to make a review of this pr. I've commented on many changes, which I've resolved now myself. I also renamed the setting id and type to MergeStrategy.

This pr now only exposes the setting and no extra command, but I think thats actually better. Also helps to not provide too many commands.

Are there any remaining comments or can this be merged?

Thank you for your time. Good for merge.

Happy New Year!

@Vinzent03 Vinzent03 merged commit d64e4d7 into Vinzent03:master Jan 4, 2026
5 checks passed
@cybersader
Copy link

@thegeneralist01 @Vinzent03
I wonder how much this addresses my past feature request
#803 - Conflict handling for multi-device usage

@thegeneralist01
Copy link
Contributor Author

@thegeneralist01 @Vinzent03

I wonder how much this addresses my past feature request

#803 - Conflict handling for multi-device usage

Based on the problem statement, I think this could serve as at least a workaround or, more broadly, a partial solution.

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

6 participants