To delete a branch, I know at least these commands:
git branch oldbranch -d
git branch oldbranch -D
The first one deletes the branch if it was fully merged, the second one deletes it in any case.
Now consider a workflow where a branch got rebased into master, not merged. The first command won't remove the branch (it was not merged). The second one will delete the branch, but it will do it in any case (even if rebase wasn't done yet). I wonder if there's a safer way to remove the branch, which can be:
- in a worse case "delete if diff between the current branch and master is emtpy"
- in a better case (since master can have other new commits) "delete if master contains commits which are ~equal to the commits of this branch since its creation" (sure, there can be problems with the "equal" bit in some cases, but for simpler ones..)
Do you know any such command?