Hey SourceTree, I WANNA DELETE MY LOCAL BRANCH MESSINESS!



  • There's like a billion of these annoying local branches just plopped in my Git shit, and I don't wanna see 'em anymore. Most are merged already, some are deleted on the server, a good portion I only even pulled in the first place to test some other idiot's pull request.

    THIS OUGHT TO BE EASY!

    Look, SourceTree has a little dialog box where it just lists all the branches and has a Delete button right there. Yay! But... why the checkboxes? It's a listbox. Can't I just, you know, select the items in the list?

    Yeah, you must be able to, it would be MUCHO RETARDED for SourceTree to ignore all GUI conventions of the last 30 years of software development and require you to click 300 checkboxes instead of just shift-clicking a few list items! RIGHT? RIGHT!??!?!?!!

    Well the selection bit works, so I'm confident now that the Delete button will do what I want, and the makers of SourceTree aren't retarded idiot-morons who should be put in straightjackets for their own protection.

    And... once again I am disappointed with the state of modern software development.

    #HOW DO YOU EVEN FUCK THIS UP!


    Did the guy who wrote this code never even *use* a computer before? He fucking *went out of his way* to make a multi-select list box, then choked when it came time to wire-up the Delete button. Jesus Christ. How do you even fuck this up?!

    Remember this next time some moron tells you SourceTree is a "good" UI for Git. SourceTree is A PIECE OF FUCKING SHIT.

    Now I'll be here clicking 400 tiny checkboxes for the next half hour, this is now my job.


    ADDED BLAKEY-BONUS: I looked up how to do this on the CLI, and it's even MORE convoluted and idiotic. Somehow. It's either like a 20-line Bash script, or a 500-line CLI command that'll make your head spin and uses like 27 pipes to accomplish this simple fucking task. ("git cleanup-local-branches" is too fucking hard I guess. Fucking Git.)


    MORE BLAKEY-BONUS: SourceTree's GUI framework is so broken, the checkboxes don't scroll with the list, but instead stay in-place and get linked to whatever list item happens to be next to it.

    How can I tell?

    Because they added this "cute" little fade-in animation when you click a checkbox. And when you have a checkbox selected and then scroll the list, you can see the checkbox fade-out. Even though that makes no sense and is visually confusing and jarring.



  • @blakeyrat said:

    ADDED BLAKEY-BONUS: I looked up how to do this on the CLI, and it's even MORE convoluted and idiotic. Somehow. It's either like a 20-line Bash script, or a 500-line CLI command that'll make your head spin and uses like 27 pipes to accomplish this simple fucking task. ("git cleanup-local-branches" is too fucking hard I guess. Fucking Git.)

    I was going to point that out.

    Having a list of branches, with little checkboxes I can select and delete all at once? GIMME!

    BTW why do you have all these branches anyway? At most, you should only generate a new branch every day or so. You shouldn't need a special consideration for multi-select (although it wouldn't hurt, of course).



  • @blakeyrat said:

    Because they added this "cute" little fade-in animation when you click a checkbox. And when you have a checkbox selected and then scroll the list, you can see the checkbox fade-out. Even though that makes no sense and is visually confusing and jarring.

    I've actually seen this in WPF as well, with checkboxes as well as radio buttons. I hated it. I'm not sure if it was a custom theme or a result of how animations work in WPF.



  • @cartman82 said:

    BTW why do you have all these branches anyway?

    Generally speaking there's a branch for every bug I've touched.

    And probably 60-70% of all pull requests I end up doing the code review of.

    That's way more than one per day. Today alone I made like 5-6 branches, and it's only 2:15.



  • @blakeyrat said:

    Yeah, you must be able to, it would be MUCHO RETARDED for SourceTree to ignore all GUI conventions of the last 30 years of software development and require you to click 300 checkboxes instead of just shift-clicking a few list items!

    Well I guess multi-select listboxes aren't that common, and it might be a little confusing for some.

    @blakeyrat said:

    SourceTree's GUI framework is so broken, the checkboxes don't scroll with the list, but instead stay in-place and get linked to whatever list item happens to be next to it.

    See, this, now this is pants-on-head retarded.



  • @Maciejasjmj said:

    Well I guess multi-select listboxes aren't that common, and it might be a little confusing for some.

    You tell the best jokes. Especially that second bit, considering this is git we're talking about.



  • @blakeyrat said:

    ADDED BLAKEY-BONUS: I looked up how to do this on the CLI, and it's even MORE convoluted and idiotic. Somehow. It's either like a 20-line Bash script, or a 500-line CLI command that'll make your head spin and uses like 27 pipes to accomplish this simple fucking task. ("git cleanup-local-branches" is too fucking hard I guess. Fucking Git.)

    ...on the command line, it should just be git branch -d branchname

    Edit: Or were you talking about looking up the branchnames as well?



  • @powerlord said:

    ...on the command line, it should just be git branch -d branchname

    And then another one to delete on remote
    Oops
    Can't do that if you already deleted the local one. Better check that out again and do it in correct order.



  • In before Blakeyrant about how he specifically asked how to delete local branches.



  • @powerlord said:

    In before Blakeyrant about how he specifically asked how to delete local branches.

    Whatever, remote should be another checkbox on that dialog.



  • @Maciejasjmj said:

    Well I guess multi-select listboxes aren't that common, and it might be a little confusing for some.

    Compared to a list with checkboxes next to each item? Which is oh-so-common? And not only confusing, but extraordinarily difficult-to-use if you want to select more than a few items?

    Face it: some moron in charge of SourceTree went way out of their way to make their UI significantly shittier.

    @powerlord said:

    ...on the command line, it should just be git branch -d branchname

    ... right but there's 300 of them, so.

    From what I can tell, the script lists the local branches, then lists the remote branches, then does some kind of diff between the two lists, then does a loop to run that git branch -d bullshit on each one in turn.

    Point is, why the fuck is this simple task so fucking hard?

    Also, why the fuck do people keep telling me SourceTree is this great Git client when it has so many basic fucking mistakes?



  • @blakeyrat said:

    ... right but there's 300 of them, so.

    Ooh! Ooh! Ooh! Maybe you can do like git branch -l and then pipe into xargs... or loop it through while read branch; do! THERE! SO MUCH BETTER THAN CHECKBOXES!



  • Yeah!

    Now if only there were a way to rubber-band selection a listbox without having to click once on every single item...

    Oh BTW, ANOTHER BLAKEY WTF I JUST THOUGHT OF:

    https://what.thedailywtf.com/uploads/default/original/3X/8/7/8711c9833ef7519f456df7c36c3500f20af67c33.png

    WTF is this thing? It's not a dialog, it has no title bar. (Meaning: it's also not movable or resize-able. Because obviously nobody would want to look at the content in the SourceTree window behind it to make a decision on what branches to check-- that's crazytalk! And obviously nobody would want to make it bigger so the listbox could show more than 8 items at a time-- that's wacko-sauce!)

    Oh and obviously the default action before you've interacted with it in any way should be the destructive "Delete" action, and not the harmless "Cancel" action, because we put 0.003 milliseconds of thought into our UI, damnit! And this dialog is the result of that intense concentration! Also the "Delete" button is active, even though nothing is selected to delete because OF COURSE IT IS!

    Oh and as an added bonus: when you click the "Branch" button that brings up that... thing? There's a 8-10 second delay where the UI's completely frozen-up for no apparent reason. Because Git is SO PERFORMANT, GUYZ!



  • @blakeyrat said:

    From what I can tell, the script lists the local branches, then lists the remote branches, then does some kind of diff between the two lists, then does a loop to run that git branch -d bullshit on each one in turn.

    Point is, why the fuck is this simple task so fucking hard?

    I don't know. I use TortoiseGit on Windows, and I can do this in the Browse References dialog:

    It doesn't seem to allow mixing local and remote branches in a delete... the option disappears from the menu. I can highlight all 3 remote branches and have a delete option for those, though.



  • @blakeyrat said:

    Did the guy who wrote this code never even use a computer before? He fucking went out of his way to make a multi-select list box, then choked when it came time to wire-up the Delete button. Jesus Christ. How do you even fuck this up?!

    You realize the VS does the exact same thing when trying to add references (at least in 2013)? In fact, Microsoft decided to take it a step further: if an item isn't selected and isn't highlighted, the checkbox is hidden. :WTF: ⁉

    I mean, multi-select listboxes with checkboxes aren't exactly new, but what you usually see (ok, what I usually see) is a set up where you can highlight a bunch of items, and then click one check box to toggle all the check boxes for the highlighted items. In fact, that's how VS 2008 did it. VS 2012 and 2013 don't.



  • @abarker said:

    You realize the VS does the exact same thing when trying to add references (at least in 2013)?

    Yes?

    What's your point? That if Visual Studio is broken, it's ok that SourceTree is also broken?



  • I'm smelling some cognitive idssonance here.



  • @blakeyrat said:

    ADDED BLAKEY-BONUS: I looked up how to do this on the CLI, and it's even MORE convoluted and idiotic. Somehow. It's either like a 20-line Bash script, or a 500-line CLI command that'll make your head spin and uses like 27 pipes to accomplish this simple fucking task. ("git cleanup-local-branches" is too fucking hard I guess. Fucking Git.)

    git branch -d git branch | grep ^featu
    git branch -d git branch | grep ^releas

    Sorry for the funky quote, I don't know how to type backticks into Diskourse.



  • @blakeyrat said:

    ADDED BLAKEY-BONUS: I looked up how to do this on the CLI, and it's even MORE convoluted and idiotic. Somehow. It's either like a 20-line Bash script, or a 500-line CLI command that'll make your head spin and uses like 27 pipes to accomplish this simple fucking task. ("git cleanup-local-branches" is too fucking hard I guess. Fucking Git.)

    Here's a nice script to delete all merged branches: (source)

    git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d
    

    Not super-simple, but hardly 20 to 500 lines. Thinking of it as a programming language, each statement is pretty straightforward if you've taken the couple minutes to learn the syntax.

    If you don't want to type it every time, just add an alias. I have that line aliased locally as git-rm-merged, which I can run periodically if things get messy. Alternately, if I recall correctly SourceTree can save it as a sort of "bookmark", so it's just a button click away.

    It may take more knowledge than you have currently to understand how this works, but if you want to understand it rather than just rage about it, it is not hard to learn ;)



  • Yeah, I didn't ask.

    @C4312 said:

    Here's a nice scr

    I didn't ask.

    Coding Help is over there -> 🔃 :or whatever: :you get the damned joke:



  • Now I'm wondering if this just happens in my install. Have you noticed when selecting things to stage and seeing the different chunks and diffs, that SourceTree will randomly refresh in search of changes, even though no files were touched? And deselect everything you'd selected to stage?


  • Discourse touched me in a no-no place

    @blakeyrat said:

    Coding Help is over there -> :or whatever: :you get the damned joke:

    One of us! One of us!



  • @blakeyrat said:

    What's your point?

    That you don't see it as enough of a problem in VS to start a topic about it. But put it in a git GUI and suddenly it's time for a rant topic. As @riking said:

    @riking said:

    I'm smelling some cognitive idssonance here.



  • @abarker said:

    That you don't see it as enough of a problem in VS to start a topic about it.

    So? You didn't either. Nor did Riking.

    Look, it's shitty. It's shitty in VS. It's shitty in SourceTree. What do you want from me?



  • Hey, @blakeyrat, if you really want to not have any branches in your local repository, why not just clone a new one and not check out literally every branch in the 300-branch repository?



  • I don't know. Why don't I do that.



  • You might want to see a doctor if you're having trouble figuring out why you're not doing something. You could be having a stroke! <lol:giggity:



  • Checkboxes in a list wouldn't be so bad if selecting the list item would also select the checkbox. It would work for the ones that don't know how multi select lists work who click on the checkboxes only and those who do and shift select the items.

    One could argue you should know how multi select lists work but I've seen every one of them that I've ever had a customer use fail because they don't know how to select more than one item.

    It's like using middle mouse button (the wheel) to open a link in a new tab. It works in every browser and I always do it when I explicitly want something to open in a new tab and when I pointed out this to a non-programmer co-worker who right clicked a link every time and used the context menu he gave me the look that it was not obvious.

    Remember this next time some moron tells you SourceTree is a "good" UI for Git. SourceTree is A PIECE OF FUCKING SHIT.

    In the previous git thread everyone told you SourceTree is shit, no one is arguing against it.



  • @hifi said:

    It's like using middle mouse button (the wheel) to open a link in a new tab. It works in every browser

    Except that it doesn't work on Discourse. Sometimes. Unreliably.



  • @blakeyrat said:

    Which is oh-so-common?

    Well, you can enable it in Windows Explorer - where the checkboxes are in sync with your normal selection.

    Which is the right thing to do, right?



  • I'm just trying to figure out why that takes a 50-200 line shell script.

    It seems you found a script to fully automate what you were trying to manually do in SourceTree, where it's really easier to semi-automatically do that in the CLI.

    Seriously though, try GitExtensions and stop shoving a red hot poker in your eye.



  • @Circuitsoft said:

    git branch -d `git branch | grep ^featu`
    git branch -d `git branch | grep ^releas`
    This is Windows, not Bourne; try again.

    (Actually, don't; this is Blakey's thread, and he's just here to complain, not get actual solutions.)



  • @ben_lubar said:

    @hifi said:
    It's like using middle mouse button (the wheel) to open a link in a new tab. It works in every browser

    Except that it doesn't work on Discourse. Sometimes. Unreliably.

    That's because, like the checkboxes inside the multi-select list box, they went out of their way to break it.


  • ♿ (Parody)

    @abarker said:

    You realize the VS does the exact same thing when trying to add references. In fact, Microsoft decided to take it a step further: if an item isn't selected and isn't highlighted, the checkbox is hidden.

    You're just angry that their statistics say you're Thinking About It Wrong.


  • ♿ (Parody)

    @TwelveBaud said:

    This is Windows, not Bourne; try again.

    Doesn't the Windows version of git come with some sort of bash to use with it? Or is that a third party thing?



  • Yes, it does. However, that's assuming SourceTree uses Git for Windows.


  • ♿ (Parody)

    @powerlord said:

    Yes, it does. However, that's assuming SourceTree uses Git for Windows.

    Not necessarily. It could be assuming that blakey could use it instead of SourceTree. Which I think he said he has to do sometimes for certain tasks.



  • @hifi said:

    Checkboxes in a list wouldn't be so bad if selecting the list item would also select the checkbox.

    Not so bad, but still completely unnecessary.

    @hifi said:

    It would work for the ones that don't know how multi select lists work who click on the checkboxes only and those who do and shift select the items.

    One could argue you should know how multi select lists work but I've seen every one of them that I've ever had a customer use fail because they don't know how to select more than one item.

    But Git is only for super mega pro computer user expert geniuses!!! Surely those Gods-among-men who use Git know how listboxes work!

    At least that's what people tell me whenever I complain that Git is too hard to use.

    @hifi said:

    In the previous git thread everyone told you SourceTree is shit, no one is arguing against it.

    Every time I complain about Git having no decent UIs, someone comes into the thread and recommends I use SourceTree as a "good" Git UI. It's happened several times.



  • @aliceif said:

    Well, you can enable it in Windows Explorer - where the checkboxes are in sync with your normal selection.

    Which is the right thing to do, right?

    Windows Explorer has it for touchscreen users who do not have a shift or control key they can use to make multiple-selections otherwise.

    If SourceTree had it as an option for touchscreen users, but didn't fuck over mouse users in the process, I probably wouldn't have posted this.



  • @Circuitsoft said:

    It seems you found a script to fully automate what you were trying to manually do in SourceTree, where it's really easier to semi-automatically do that in the CLI.

    I'm not going to run mysterious scripts I don't understand. Regardless of their length.

    The problem here is not me, the problem is Git and Git's awful ecosystem of broken shitty tools. Blaming the user is never the correct approach.

    @Circuitsoft said:

    Seriously though, try GitExtensions and stop shoving a red hot poker in your eye.

    I didn't ask. This isn't in the Q and A section. I am not asking a question. Go away.



  • @boomzilla said:

    Not necessarily. It could be assuming that blakey could use it instead of SourceTree. Which I think he said he has to do sometimes for certain tasks.

    If it was only my own work at risk instead of my employer's, it might be fun to attempt to run some of these script solutions to see how many are broken/incomplete.

    I'm wagering: most of them.



  • @blakeyrat said:

    @abarker said:
    That you don't see it as enough of a problem in VS to start a topic about it.

    So? You didn't either. Nor did Riking.

    @riking and I didn't start a rant about the problem in SourceTree either. I assume you ran into the problem in VS before you encountered it in SourceTree.

    I guess I need to spell it out: I don't think this is about the the listboxes. I think if this were in some program where this was the only problem you had with it, we wouldn't hear a word from you about it. This just sound like some more of your git bashing to me.



  • @abarker said:

    I guess I need to spell it out: I don't think this is about the the listboxes.

    Maybe you should read the OP again.

    @abarker said:

    I think if this were in some program where this was the only problem you had with it, we wouldn't hear a word from you about it.

    Possibly true; if everything else in SourceTree wasn't shit, I might be able to forgive one bit of it that is.

    @abarker said:

    This just sound like some more of your git bashing to me.

    Ok?

    Git is terrible. It deserves bashing.

    If you don't want to read the thread, don't read it. I didn't force you in here at gunpoint.



  • @boomzilla said:

    You're just angry that their statistics say you're Thinking About It Wrong.

    No, I'm angry because half the time I forget that those checkboxes are there when I first go to add references to a project, so I highlight a dozen libraries before I remember that I have to hit the checkboxes on them one by one. If the highlight isn't going to let me do anything, then get rid of it!



  • @abarker said:

    I highlight a dozen libraries before I remember that I have to hit the checkboxes on them one by one.

    I don't have VS2013 and the only "References" screen I'm aware of from VS2005-2010 is the "Add References" one, and it doesn't have checkboxes, but VS2010's "Choose Toolbox Items" screen is a multiselect listbox with checkboxes that appears to be similar, where you have to check the items individually instead of just highlighting them.

    A thing to try, if you select multiple items, then press the Spacebar, do the highlighted items toggle their checked state? I just tested the "Choose Toolbox Items" screen in VS2010 and it does.


  • Discourse touched me in a no-no place

    @ChaosTheEternal said:

    I don't have VS2013 and the only "References" screen I'm aware of from VS2005-2010 is the "Add References" one, and it doesn't have checkboxes

    2015 does. Of the 5 highlighted rows, only the checked one will be added to the project if I hit OK.


  • ♿ (Parody)


  • Discourse touched me in a no-no place

    What kind of jerk creates a two-dimensional pattern of checkboxes? Checkbox-to-multiselect was bad enough!



  • @ChaosTheEternal said:

    I don't have VS2013 and the only "References" screen I'm aware of from VS2005-2010 is the "Add References" one, and it doesn't have checkboxes,

    Yes, the checkboxes were new in 2013. I did not mean to imply otherwise.

    @ChaosTheEternal said:

    A thing to try, if you select multiple items, then press the Spacebar, do the highlighted items toggle their checked state? I just tested the "Choose Toolbox Items" screen in VS2010 and it does.

    No, only the checkbox on the last item I clicked is selected. Example:

    1. Highlight Microsoft.Activities.Build:
    2. Shift + Click Microsoft.Build.Framework to highlight 5 total libraries:
    3. Hit Space. Now only Microsoft.Build.Framework is highlighted. It is also the only item that was highlighted to be checked:


  • @FrostCat said:

    2015 does. Of the 5 highlighted rows, only the checked one will be added to the project if I hit OK.

    😡


Log in to reply