tags:

views:

217

answers:

2

That is, I don't want to actually delete the branch in the remote repository, but I don't want the branch locally anymore.

Can I just do git branch -d the_branch and it won't get propagated when I later git push ? Will it only propagate if I were to run git push origin :the_branch later on?

+5  A: 

You don't have to delete your local branch.

Simply delete your remote tracking branch:

git branch -d -r origin/<remote branch name>

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

VonC
The remote tracking branch is recreated after git fetch. Is it possible to exclude these?
Matt R
@Matt: I believe this would be done by setting the `remote.<name>.fetch` refspec config setting, but I am not sure if you can exclude a branch when specifying a refspec.
VonC
It appeared that way to me too; I was able to rebase my local branch though and after the fast-forward the apparent connection between the branches disappeared.
willoller
A: 

To remove the association between the local and remote branch, and delete the local branch, run:

git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
git branch -d <branch>

Worked for me ....

Dobes Vandermeer