Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

git-pull

pull

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.

like image 877
Bjorn Avatar asked Dec 18 '09 21:12

Bjorn


People also ask

How do I pull one branch from a remote?

If you have a single remote repository, then you can omit all arguments. just need to run git fetch , which will retrieve all branches and updates, and after that, run git checkout <branch> which will create a local copy of the branch because all branches are already loaded in your system.

Does git pull affect remote branch?

The short answer is simple: no, the remote-tracking branch remains unaffected.


1 Answers

git fetch origin
git checkout -b newoldbranch oldoldbranch
like image 103
Michael Krelin - hacker Avatar answered Sep 24 '22 13:09

Michael Krelin - hacker