I have a project with a friend with only one branch, master
. My friend last worked on the project and I fetched (git fetch
) his work just to have a look. This created a branch called origin/master
:
Project ps1$ git branch -a
* master
remotes/origin/master
I checked it out (git checkout origin/master
) and I don't agree with everything that was done, so I don't want to merge now. I'm going to let my friend work more on it. I tried to delete this fetched branch just to clean up, using either
git branch -d remotes/origin/master
or
git branch -d origin/master
but it said the branch was not found in both cases. How do I get rid of this branch (should I even do this?)?
git branch -rd origin/master
should work.
From the documentation:
Use
-r
together with-d
to delete remote-tracking branches. Note, that it only makes sense to delete remote-tracking branches if they no longer exist in the remote repository or if git fetch was configured not to fetch them again.