Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save terry-heinel/4081cfab8d11dcf31a84528905738a78 to your computer and use it in GitHub Desktop.
Save terry-heinel/4081cfab8d11dcf31a84528905738a78 to your computer and use it in GitHub Desktop.
How to make Git stop track a remote branch without deleting the remote branch.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment