mcasper / git-clean

A Command Line Tool written in Rust for cleaning up local and remote Git branches
MIT License
54 stars 9 forks source link

git-clean doesn't work with branches that have been github squashed on merge #18

Closed jfrost closed 8 years ago

jfrost commented 8 years ago

Sadness ensues as the branches build up.

mcasper commented 8 years ago

Yeah, this is an annoying one :( I realized awhile ago that my rebase tests here don't cover this case, because Github both squashes your commits, and doesn't create a merge commit.

Anyways, this is on the docket for fixing once I'm back in the states

mcasper commented 8 years ago

So we're actually stuck in the middle of a massive thunderstorm right now, so I've had some time to poke at this one.

When Github squashes and rebases your branch, the resulting commit that's merged in is entirely different and would never exist on your local copy of the branch, so most of git's built in "what branches are behind master?" tools won't work.

Right now, I'm thinking the easiest way to do this is to git diff the head of your local copy of each branch with master, and see if there are any changes. If there are none, we'll offer it up as a potential deletion, otherwise we'll assume it's still current.

@jfrost thoughts?

jfrost commented 8 years ago

I like it, but since it's a little sketchy, maybe we should default to No instead of Yes in this case?