SystemsInCode
SystemsInCode

Reputation: 699

Git refuses to set a remote tracking branch

My git was refusing to create a branch from a remote branch but was error-ing with 'is-it-not-a-commit'as per this issue: Why is it not a commit and a branch cannot be created from it?

But as suggested by @SillyFreak it started working after I ran:

git fetch upstream refs/heads/master:refs/remotes/upstream/My-Remote-Branch-Name

However it only created a local branch (with new name as I prior deleted a error branch) without the tracking attribute.

When I try to add it with Git branch -u upstream/My-Remote-Branch-Name it says fatal: Cannot setup tracking information; starting point 'upstream/My-Remote-Branch-Name' is not a branch.

There are still some gremlins here - not sure what to try next

Upvotes: 0

Views: 1771

Answers (1)

Mark Adelsberger
Mark Adelsberger

Reputation: 45649

git fetch upstream refs/heads/master:refs/remotes/upstream/My-Remote-Branch-Name

I do not think this means what you think it means.

What you've done is to create, locally, something that looks like a remote tracking ref for a remote branch that would be called My-Remote-Branch-Name; but that ref is just pointing to the remote's master (as of the time of this command).

You also have not created a local branch.

git branch -u upstream/My-Remote-Branch-Name

This command is for when the branch already exists on the remote. Based on what you've posted, it looks like it does not.

The first thing it sounds like needs done is to clarify why a branch you believe exists on the remote is not showing up in any of the commands you're running.

Upvotes: 1

Related Questions