Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I download a new remote branch without merging?

Tags:

git

I've been working on the master branch in my Git repository for a while. It's hosted on GitHub and cloned on two of my computers. Now I started a new branch on one computer and pushed it to GitHub. Now they know both branches, but the other computer still only knows about the master branch, not the feature branch.

When I try to pull the feature branch from GitHub, Git will merge it into my master, which is not what I want.

How can I download the feature branch from GitHub into my local repository and end up having the two branches and no merge? I'm going to merge them when it's ready, not now.

If possible, I'm interested in what to do with TortoiseGit.

like image 974
ygoe Avatar asked May 24 '14 19:05

ygoe


People also ask

How do I pull a remote branch without merging?

You can use git fetch origin b1 to only fetch remote branch without merge. Merge execute because you was on master branch, and not your local b1 branch. Show activity on this post.

How do I pull a new 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.

How do I download a different branch?

If you swap to a different branch with the dropdown, you'll continuing viewing that branch, at least until you navigate away from the file viewer. While on a branch, clicking “Download Zip” from the Code dropdown will lead you to a download for the specific branch you're on.

What command will download remote branches from remote?

Git fetch summary In review, git fetch is a primary command used to download contents from a remote repository. git fetch is used in conjunction with git remote , git branch , git checkout , and git reset to update a local repository to the state of a remote.


1 Answers

You can do git fetch origin on the command line. This will update your local copy so that it knows about the new branch. Then, if you want to checkout the new branch, simply git checkout BRANCHNAME should track the remote.

like image 150
brock Avatar answered Oct 02 '22 15:10

brock