Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undo Git Track Command

Tags:

git

branch

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!

like image 221
Stunner Avatar asked Mar 26 '26 02:03

Stunner


1 Answers

Just delete the branch.

git branch -d origin/branch1
like image 165
iblue Avatar answered Mar 28 '26 17:03

iblue