1

I have 2 PCs, an M1 Mac and a Linux Ubuntu. The issue pertains git using the terminal. When I use the Linux one and I pull from upstream with a conflict (i.e. git pull upstream master), I can open the relevant files and see where the conflict is. Something like:

<<<<<<< HEAD
content in head 
=======
totally different content to merge later
>>>>>>> new_branch_to_merge_later

When on Mac, I do get the error message, but the file is not changed (see below for the message). I want the linux behavior on Mac.

% git pull upstream master
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 267 bytes | 267.00 KiB/s, done.
From /tmp/git-example/gitlab/tasks
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> upstream/master
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint: 
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint: 
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
  • Hi, if you read the message displayed by git, you will see it wasn't a conflict problem. git didn't perform a merge at all. It appears that, since git 2.27 (see question suggested as duplicate), git wants you to explicitly configure how `git pull` should behave after fetching the remote branches. Follow the instructions in the warning message if you want to keep using `git pull`. – LeGEC May 21 '22 at 19:21
  • Another option is to stop using `git pull`, and instead : use `git fetch` to download changes from the remote, inspect what you have at hand (open a graphical viewer, or use `git log --oneline --graph master upstream/master` to view the differences), and choose whether you should run `git merge` or `git rebase` -- or something else entirely. – LeGEC May 21 '22 at 19:22
  • 1
    I'm new, so I don't have the yet the rights to answer my own question. Just run: ```git config pull.rebase false``` and ```git pull upstream master``` – user19169870 May 21 '22 at 19:57

0 Answers0