Question

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.

Was it helpful?

Solution

git fetch origin
git checkout -b newoldbranch oldoldbranch

OTHER TIPS

git pull repo branch is basically shorthand for git fetch repo branch and git merge repo/branch. I'm not one to often say RTFM, especially with git, but it is the first line of the git-pull docs. "git-pull - Fetch from and merge with another repository or a local branch". The implicit merge is causing the conflict. You just want a fetch & checkout as Michael said.

Can't you simply check it out ?

git checkout branch_name

?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top