2

Added a new Branch to my Github, but can't find a way to have my local repo "know" about it. I have my local repo using the master branch (the only one it knows about), and it is several commits ahead of the other new remote branch it is not aware of. I want to make my local git aware of this new branch, and then push those commits to the new remote branch.

1 Answer 1

3

Lets say that your remote is called origin (the default) and the branch is called feature1. Then first of all you must do a pull (or a fetch).

git pull 

This will bring down information to your local repository about the branch. The output of the command should include something like this

 * [new branch] feature1 -> origin/feature1 

After that you do

git checkout feature1 

This should create a local branch called feature1 that will track the remote branch, so that you can pull and push to the corresponding remote. The output should look like this

Branch feature1 set up to track remote branch feature1 from origin. Switched to a new branch 'feature1' 

If that fails for some reason, or you want to be really explicit about it, you can instead do

git checkout --track origin/feature1 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.