Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pull remote branch into local repo with different name?

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 ?

like image 601
Cosmin Atanasiu Avatar asked Aug 20 '12 18:08

Cosmin Atanasiu


People also ask

How do you pull someone's remote 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> .

How do I pull a branch from remote repository to local?

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 change the name of my remote branch?

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.


1 Answers

git checkout -b myBranchName repo2/master
like image 83
KingCrunch Avatar answered Sep 20 '22 23:09

KingCrunch