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.
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With