Choose Git merge strategy for specific files (“ours”, “mine”, “theirs”)

I am in the middle of rebasing after a git pull –rebase. I have a few files that have merge conflicts. How can I accept “their” changes or “my” changes for specific files? $ git status # Not currently on any branch. # You are currently rebasing. # (fix conflicts and then run “git rebase … Read more

What exactly does git’s “rebase –preserve-merges” do (and why?)

Git’s documentation for the rebase command is quite brief: –preserve-merges Instead of ignoring merges, try to recreate them. This uses the –interactive machinery internally, but combining it with the –interactive option explicitly is generally not a good idea unless you know what you are doing (see BUGS below). So what actually happens when you use … Read more

How to get “their” changes in the middle of conflicting Git rebase?

I have conflicting branches, feature_x branched from main. Let’s say when rebasing feature_x on current main, while resolving conflicts, I decide to take some (not all) of “their” (i.e. main) files as-is. How do I do that? I tried: git checkout main:foo/bar.java fatal: reference is not a tree: TS-modules-tmp:foo/bar.java git checkout refs/heads/main:foo/bar.java fatal: reference is … Read more