Is it possible, to merge
a branch and automatically delete
it with a single command? The delete step should only be executed if merging was successful.
No, git doesn't support this at the same time.
However, you can run the commands in a shell conditionally:
git merge source-branch && git branch -d source-branch
Edit:
-d
will only remove merged branches while -D
will also remove unmerged branches, so -d
will ensure that the branch is merged and you don't delete a branch by accident.