17 10 / 2012
git remove tracking local branch when push to origin
I’m not sure if the title is right or wrong. I know that there’s no such thing as local tracking branch. But what I want to do is to remove the local branch from being pushed when I do “git push”. Of course you have to do “git push -u <branch>” first, so that git knows that you want to keep traking <branch> when you do push.
From the search results, there are two (2) workable solutions.
1. git branch -d -r origin/<remote branch name>
I’m not sure if this is what I want. I don’t really want to delete the branch in the remote repo but only in my local repo.
2. This is the one that I did to remove my local branch copy and tracking while keeping my remote branch in the origin/<branch>
git config --unset branch.<branch>.remote
git config --unset branch.<branch>.merge
git branch -d <branch>
Hopes that this will help others who need to remove tracking their local branch.
references: