Does git push origin :<branch>
delete the local branch as well? I need to save my local changes but delete the remote branch, and I can't test out creating a new branch/pushing and deleting right now. If not, is there any other way to delete a remote branch but keep the local branch/changes in the branch?
Steps to delete remote Git branchesIssue the git push origin –delete branch-name command, or use the vendor's online UI to perform a branch deletion. After the remote branch is deleted, then delete the remote tracking branch with the git fetch origin –prune command.
Deleting a branch LOCALLYThe -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet. The branch is now deleted locally.
In Git, local and remote branches are separate objects. Deleting a local branch doesn't remove the remote branch.
No, it doesn't delete the local branch. Doing the command you stated does exactly what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With