Alright I did a little bit of research on this but I couldn't find an exact answer, so I have to ask.
I have 2 remotes: origin and repo2.
I'd like to do something like
git pull repo2 master
But this would pull the master branch of the repo2 into my master. Can I specify a different branch to pull into, for my local branch ?
If you want to check out a remote branch someone published, you first have to use git fetch . This command downloads the references from your remote repository to your local machine, including the reference to the remote branch. Now all you need to do is use git checkout <remote branch name> .
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.
Rename a Remote Git Branch There isn't a way to directly rename a Git branch in a remote repository. You will need to delete the old branch name, then push a branch with the correct name to the remote repository. The output confirms that the branch was deleted.
git checkout -b myBranchName repo2/master
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