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?

Charles
  • 50,943
  • 13
  • 104
  • 142
cori
  • 8,666
  • 7
  • 45
  • 81

1 Answers1

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}
    
Sachin Jain
  • 21,353
  • 33
  • 103
  • 168