-2

I'm new to using Git, and we have a remote main set up and I have pulled the updated changes into my local main, my question is how do I update the local branches that I will create with those updated changes?

Can I do

git pull origin main

in the local branch or should I switch to the local branch and do

git merge main

on the local branch?

Obsidian
  • 3,719
  • 8
  • 17
  • 30
Darragh.H
  • 3
  • 6

1 Answers1

0

If the goal is to update a local branch mybranch from the remote main, you do not need a local main. Indeed, if you are following good git flow practices, and merging to main via pull requests, you should have no local main at all.

Just work on mybranch. From time to time git fetch and then git merge origin/main or git rebase origin/main, to acquire the latest state of remote main.

matt
  • 515,959
  • 87
  • 875
  • 1,141