3days since the last Git and AI fuck-up

How do I delete a git branch locally and remotely?

Sahil Bhatacharyafrom the archive

Git branches are an essential part of your daily development process, but once you or your team have finished with a feature and merged it into your remote's master branch, you would want to delete it from the local and as your remote. You can do it in two ways:

shell
git push --delete <remote_name> <branch_name>

To delete a local branch, use the following:

shell
git branch -d <branch_name>

Note:

  • -d option for git branch the command is an alias of --delete flag, which deletes the branch if it has already merged in its upstream branch.
  • -D is also an option --delete flag, which deletes the branch "regardless of its merged status."

Originally Posted On: StackOverflow

Tagged solving-mistories, git-remote, git-branch, git-push, local