How can I delete a remote branch in git without conflicts?

There is a branch on the remote control that 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 the master. Whenever I try to pull it, I get conflicts. I just want to create an exact duplicate of the remote branch of my local system. Why will this lead to conflicts?

I tried:

git pull origin branch_name:branch_name 

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

+7
git git-pull pull
source share
3 answers
 git fetch origin git checkout -b newoldbranch oldoldbranch 
+10
source share

git pull repo branch is basically a shorthand for git fetch repo branch and git merge repo/branch . I don't often say RTFM, especially with git, but this is the first line of git-pull docs , "git-pull is fetching and merging with another repository or local branch." Implicit merging causes a conflict. You just want fetch and checkout , as Michael said.

+4
source share

Can't you just check it out?

 git checkout branch_name 

?

+2
source share

All Articles