问题
I know the command git push -d <remote> <branch_name>
I want to delete remote branch only from my local git env. The command above removes remote branch from my local and remote github also.
However, if I had removed remote branch in github directly like this,
there is no branch named feature/search
in remote anymore, the command fails.
So, how can I remove remote branch in my local without interacting remote github?
回答1:
Previously answered here.
You can use git branch -D
or git branch -d
for deleting a branch locally.
from the official doc
-d
--delete
Delete a branch. The branch must be fully merged in its upstream branch, or in HEAD if
no upstream was set with --track or --set-upstream-to.
-D
Shortcut for --delete --force.
In your case, it should be,
git branch -d feature/search
来源:https://stackoverflow.com/questions/63146613/how-to-remove-remote-branch-only-from-my-local-git