0

I'm cloning a fork of a project in github and want to set up an upstream remote to track the original project. As I understand things, fetching the upstream remote should create tracking branches of the remotes branches in my local repo, but git isn't doing that, so either I misunderstand the process or I'm doing something wrong.

I've tried both

git remote add upstream https://github.com/dude1/awesome-project.git
git fetch upstream

and

git remote add -f upstream https://github.com/dude1/awesome-project.git

and when I do git branch -a after either set of operations all I have is my origin tracking branches.

What am I doing wrong?

1 Answer 1

0

Adding remote repository does not track all the branches on remote repo. To track remote branches, you should do

  • If you don't have branch on your local repo and want to create one.

    git branch {branch_name} upstream/{branch_name}
    

where {branch_name} represents your branch name.

It will create a branch in your local repo and will track remote branch which you have specified.

  • If you have branch on your local repo and want to push it to remote repo,

    git push upstream {branch_name_on_local}:{branch_name_in_repo}
    

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.