0

I think that a git pull command is an alias for a git fetch and a git merge.

I would like to do a git pull origin master in several steps. It think it could be something like this:

git fetch origin master
git merge <remote fetched branch>
tzi
  • 8,719
  • 2
  • 25
  • 45

2 Answers2

2

It would be just simply

git fetch origin master
git merge origin/master

The first command fetches master from origin. The second merges the remote into your topic branch.

isherwood
  • 58,414
  • 16
  • 114
  • 157
  • This assumes that you are on `master` branch – Shiplu Mokaddim Sep 16 '20 at 13:57
  • @ShipluMokaddim, that's incorrect. It doesn't matter what branch you're on. – isherwood Sep 16 '20 at 13:59
  • The OP actually asked about running git pull when he is in `master` branch. In your answer, you mentioned about topic branch. The command will indeed merge origin/master to the current branch which is topic branch. And for OP it's `master`. – Shiplu Mokaddim Sep 16 '20 at 15:45
1

A git fetch update the remote-tracking branches under refs/remotes/<remote>/. So the commands should be:

git fetch origin master
git merge refs/remotes/origin/master

Thanks to this answer about the difference between git pull a git fetch.

Community
  • 1
  • 1
tzi
  • 8,719
  • 2
  • 25
  • 45