Search code examples
gitpullgit-pull

How do I pull a remote branch in git without conflicts?


There is a branch on remote I would like to work on. It is old and I no longer have an old copy of it on my local machine. It is really far behind master. Whenever I attempt to pull it I get conflicts. I just want to create an exact duplicate of the remote branch on my local system. Why would that lead to conflicts?

I tried:

git pull origin branch_name:branch_name

That created a new branch on my local machine with the right name, but it led to conflicts.


Solution

  • git fetch origin
    git checkout -b newoldbranch oldoldbranch