git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

git-delete-merged-branches are removing branch without remote

Open kessiler opened this issue 8 years ago • 3 comments

E.g: git feature removing-branch-without-remote git checkout master git delete-merged-branches

Result: feature/removing-branch-without-remote just gone :/

kessiler avatar Mar 17 '16 09:03 kessiler

//cc @spacewander had you seen this before?

hemanth avatar Mar 21 '16 13:03 hemanth

This sounds like expected behaviour to me. If the branchremoving-branch-without-remote doesn't have any new/unmerged commits, then it is considered "merged".

nicolaiskogheim avatar Mar 21 '16 19:03 nicolaiskogheim

It doesn't remove branches without remote. It just removes branches whose tips are reachable from HEAD.

Let's look at the example:

         C  ---   E merged
       /          \
A --- B --- D ---  F  current

As @nicolaiskogheim says, once you create a branch removing-branch-without-remote without new commits:

         C  ---   E merged
       /          \
A --- B --- D ---  F  current/removing-branch-without-remote

The removing-branch-without-remote is still reachable from commit F.

In some cases, the merged branch's tip will be the same as current branch's. One of them is fast-forward merge.

Consider this example:

         C  ---   E merged
       /          \
A --- B --- - ---  E  current(fast-forward)

If we define a commit can't reach itself, the fast-forward merged branch will be omitted.

spacewander avatar Mar 24 '16 04:03 spacewander