'Git pull acting like git fetch?

For one of my company's repositories, the command git pull has started acting like git fetch. It pulls down all updates but does not actually merge the changes into the branch. I have to then run git merge origin/master to merge them.

What could cause this? I've never seen such behavior before. It doesn't seem to have affected other users of the repository, it's only me. It also hasn't affected other repositories I use. My git version is git version 2.24.3 (Apple Git-128) and the repo is hosted on GitHub although I doubt that matters.

Edit with additional requested details:

The output of git status before any other action:

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean

Followed by git pull:

remote: Enumerating objects: 3333, done.
remote: Counting objects: 100% (1623/1623), done.
remote: Compressing objects: 100% (128/128), done.
remote: Total 3333 (delta 1517), reused 1554 (delta 1488), pack-reused 1710
Receiving objects: 100% (3333/3333), 2.07 MiB | 15.83 MiB/s, done.
Resolving deltas: 100% (2113/2113), completed with 355 local objects.
From github.com:repo/url
   6c1fab37s6b7..7acd6e422762  master                                            -> origin/master

git status after git pull:

$ git status
On branch master
Your branch is behind 'origin/master' by 94 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)

nothing to commit, working tree clean

For good measure, the output of git branch -vv:

$ git branch -vv
* master                                              6c32ab37afb7 [origin/master: behind 94] commit message

When using GIT_TRACE=1, this additional info is gleaned:

Before pull output:

09:46:36.847574 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/bin
09:46:36.848324 git.c:439               trace: built-in: git pull
09:46:36.865183 run-command.c:663       trace: run_command: git fetch --update-head-ok
09:46:36.870423 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Library/Developer/CommandLineTools/usr/libexec/git-core/git
09:46:36.871061 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/libexec/git-core
09:46:36.871707 git.c:439               trace: built-in: git fetch --update-head-ok
09:46:36.890545 run-command.c:663       trace: run_command: unset GIT_PREFIX; ssh [email protected] 'git-upload-pack '\''org/repo-name.git'\'''
remote: Enumerating objects: 3232, done.
remote: Counting objects: 100% (1480/1480), done.
remote: Compressing objects: 100% (229/229), done.
09:46:41.239506 run-command.c:663       trace: run_command: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 94201 on USERNAME' --pack_header=2,3232
09:46:41.252417 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Library/Developer/CommandLineTools/usr/libexec/git-core/git
09:46:41.254014 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/libexec/git-core
09:46:41.256304 git.c:439               trace: built-in: git index-pack --stdin -v --fix-thin '--keep=fetch-pack 94201 on USERNAME' --pack_header=2,3232
remote: Total 3232 (delta 1333), reused 1323 (delta 1243), pack-reused 1752
Receiving objects: 100% (3232/3232), 4.03 MiB | 19.39 MiB/s, done.
Resolving deltas: 100% (1972/1972), completed with 268 local objects.
09:46:42.117286 run-command.c:663       trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
09:46:42.126065 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Library/Developer/CommandLineTools/usr/libexec/git-core/git
09:46:42.126771 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/libexec/git-core
09:46:42.127570 git.c:439               trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs

After pull output:

09:46:43.640301 run-command.c:663       trace: run_command: git gc --auto
09:46:43.647411 exec-cmd.c:139          trace: resolved executable path from Darwin stack: /Library/Developer/CommandLineTools/usr/libexec/git-core/git
09:46:43.648461 exec-cmd.c:238          trace: resolved executable dir: /Library/Developer/CommandLineTools/usr/libexec/git-core
09:46:43.649426 git.c:439               trace: built-in: git gc --auto
git


Solution 1:[1]

Running git pull with no additional arguments is mostly equivalent to running:

git fetch
git merge

That is, there is no extra origin/master passed to git merge here. So if you're on branch br1 whose upstream is origin/br1, and you run git merge, you're effectively running git merge origin/br1, not git merge origin/master.

My guess, then—since you have not provided enough information in the question—is that whatever branch you are on right now, it has an upstream, but that upstream is not origin/master. It would be best to show a git status command and its output before the git pull command and its actual output; these would help confirm which branch you are on when you run git pull, and what its upstream is set to.

Note that you can configure git pull to run git rebase as its second step, and in modern Git (but not that out of date Apple version) you will need to configure one of the pull.* settings as well. I recommend not using git pull at all, though: run git fetch, then run your own second command. Aside from the newest Git that requires the new pull.* settings, it's too easy to have git pull do things you didn't mean for it to do.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 torek