Skip to content Skip to sidebar Skip to footer

Delete Remote Branch In Git Command

Delete Remote Branch In Git Command. Replace the remotename and branchname with appropriate names. Deleting a local branch doesn’t remove the remote branch.

git delete remote branch Code Example
git delete remote branch Code Example from www.codegrepper.com

To create remote branch with other name speicify the remote branch branch name just after local branch name seprated with colon (:). There is a shortcut command to delete the branch remotely. The above command creates branch on remote git repository with same name as local “stage1” and push all files there.

The Command To Delete A Remote Branch Is:


Replace the remotename and branchname with appropriate names. Below command remove last 2 commits from the top. I normally fetch the remote, create a branch out of it, work on it, push changes to my origin remote, raise pr to main repo and once it gets merged, i delete the feature branch.

You Can Also Create Branch On Remote Branch With Other Name.


It should download the branch references from the remote repository. This will forcefully delete the branch even if it hasn’t been pushed or merged with the remote. The above command creates branch on remote git repository with same name as local “stage1” and push all files there.

You Will Still Find The Deleted Branch In The Remote Because We Didn’t Delete It In The Remote.


There is a shortcut command to delete the branch remotely. This helps me segregate many tasks and keep the tree clean. You can’t use the git branch command to delete a remote branch.

To Create Remote Branch With Other Name Speicify The Remote Branch Branch Name Just After Local Branch Name Seprated With Colon (:).


Deleting a local branch doesn’t remove the remote branch. How to remove the last two commits.

Post a Comment for "Delete Remote Branch In Git Command"