Posted By: Anonymous
How do you stop tracking a remote branch in Git?
I am asking to stop tracking because in my concrete case, I want to delete the local branch, but not the remote one. Deleting the local one and pushing the deletion to remote will delete the remote branch as well:
Can I just do
git branch -d the_branch, and it won’t get propagated when I later
Will it only propagate if I were to run
git push origin :the_branch later on?
git branch --unset-upstream
You don’t have to delete your local branch.
Simply delete the local branch that is tracking the remote branch:
git branch -d -r origin/<remote branch name>
-r, --remotes tells git to delete the remote-tracking branch (i.e., delete the branch set to track the remote branch). This will not delete the branch on the remote repo!
there’s no such concept of local tracking branches, only remote tracking branches.
origin/masteris a remote tracking branch for
git config --unset branch.<branch>.remote git config --unset branch.<branch>.merge
Remove the upstream information for
If no branch is specified it defaults to the current branch.
That will make any push/pull completely unaware of
origin/<remote branch name>.