I have recently cloned a repo of our development code branch in my system:
git clone https://gitserver.com/product
After the clone was successful I get the below status on query:
$ git branch * develop
I realized that now this branch needs to be deleted, hence:
$ git checkout develop Already on 'develop' Your branch is up-to-date with 'origin/develop'. $ git branch -d develop error: Cannot delete branch 'develop' checked out at 'C:/work/test'
I am not sure whether we should try a GIT command or Unix command 'rm -rf' to delete a local develop branch repository? Lastly why no one can delete 'develop' branch.
So, to delete the remote branch AND locally-stored remote-tracking branch in one command, just use git push origin --delete <branch> . Then, you just need to delete the local branch with git branch -D branch . That covers the deletion of all 3 branches with only 2 commands.
Unlike local branches, you can't delete a remote branch using the git branch command. However, you need to use the git push --delete command, followed by the name of the branch you want to delete.
Visual Studio 2017 provides you easy access to both. To delete a local branch, right click on it and select Delete from the context menu. To delete a remote branch listed under the remotes/origin, right click on the desired branch and select Delete Branch From Remote from the context menu that pops up on the screen.
It is safe to delete your local branch after you pushed your changes to your own remote repository. The pull request is unrelated to this, because it is simply a request to the maintainers of the original repository to merge your changes back into their code base.
You cannot delete the branch you are currently on.
Try creating a new branch
git checkout -b new-branch
Then delete the develop branch
git branch -d develop
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