You don't have to delete your local branch.
Simply delete your remote tracking branch:
git branch -d -r origin/<remote branch name>
(This will not delete the branch on the remote repo!)
See "Having a hard time understanding git-fetch"
there's no such concept of local tracking branches, only remote tracking branches. So origin/master is a remote tracking branch for master in the origin repo
As mentioned in Dobes Vandermeer's answer, you also need to reset the configuration associated to the local branch:
git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
That will make any push/pull completely unaware of origin/.
Source: http://stackoverflow.com/questions/3046436/how-do-you-stop-tracking-a-remote-branch-in-git
I find this part ironic because it further causes confusion about branches and tracking branches and
git fetch
.git fetch
updates your locally-stored remote-tracking branches to contain the latest changes from their respective remote branches. So, when you saythere's no such concept of local tracking branches, only remote tracking branches
, that's not quite true--it depends how you word it and what you mean, as that English is ambiguous.This is because there is such a thing as
local tracking branches
if what you mean is a local (meaning: stored locally on your computer's hard drive) branch which is a tracking branch, meaning it tracks a remote branch. So, some people may saylocal tracking branch
and meana locally-stored branch which tracks a remote branch
, and that is a true and correct statement. So, a better wording would be to say thatgit fetch
updates your locally-stored remote-tracking branches with the latest changes from their respective remote branches which they track.Also, this line was very helpful. Thank you! This is what I came here for. :). I just learned something: