xexe
xexe

Reputation: 129

Accidentally did a branch origin set up to track local branch

I accidentally did:

git checkout mybranch
git branch --set-upstream origin mybranch 

Git says:

Branch origin set up to track local branch mybranch.

How do I reset that and what could it do to me?

Thanks,

Upvotes: 2

Views: 985

Answers (2)

Máté
Máté

Reputation: 2345

That means you just have a local branch that is set to be tracking the remote branch with the same name. No harm in having that, you are not forced to use the remote branch;)

You can remove the tracking link with

--no-track

or delete the remote branch:

git push origin :branch-name

For the latter, if you want to, you need to specifically remove the branch with the -d option.

Upvotes: 0

Jan Hudec
Jan Hudec

Reputation: 76256

If all else fails, just edit .git/config with text editor. All the command does is set there

[branch "origin"]
merge=refs/heads/mybranch

so just remove the invalid setting.

Upvotes: 3

Related Questions