Stunner
Stunner

Reputation: 12214

Undo Git Track Command

I was trying to track a remote branch and ended up doing the following:

$ git branch --track origin/branch1
Branch origin/branch1 set up to track local branch branch1.

Which is obviously not what I intended to do. How would I undo this setting? I tried rectifying it myself:

$ git branch --track origin branch1
error: there are still refs under 'refs/heads/origin'
fatal: Failed to lock ref for update: Is a directory
$ git branch --track branch1 origin/branch1
fatal: A branch named 'branch1' already exists.
$ git branch --no-track origin/branch1
fatal: A branch named 'origin/branch1' already exists.

...to no avail. Thanks in advance!

Upvotes: 3

Views: 883

Answers (1)

iblue
iblue

Reputation: 30434

Just delete the branch.

git branch -d origin/branch1

Upvotes: 2

Related Questions