Category: Blog

  • Deleting Stale Local Database Git Branches with SSMS–#SQLNewBlogger

    I wrote a post recently about pruning branches in git. That’s part of the job, but the other part is removing local branches. This post looks at one way to do that in a semi-manual fashion.

    This could be automated, but it took seconds, so I did a quick manual thing. I’ll work on an automated way, but since I do this rarely, manual is fine for me.

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers. You can see all posts on Git as well.

    Getting a List of Branches to Delete

    In the last post I showed how to get a list of branches with dry run. This was the image I showed of branches. If I re-run that without the dry run, the branches are removed.

    2024-04-11 10_51_57-cmd

    The output is similar, but either set of output works. Once we have a list of branches, what do we do? Let’s use SSMS to help.

    SSMS Makes This Easy

    If I highlight the results of my git prune, I can copy/paste those into SSMS. You can see below I’ve done this, and then held the ALT+Shift key to select a bunch of text in a box. This is all the text apart from the branch names.

    2024-04-11 10_54_39-SQLQuery4.sql - not connected_ - Microsoft SQL Server Management Studio

    Once I’ve done this, I can let go of those keys and type “git branch –d “, which will replace the text on every line. You can see this below.

    2024-04-11 10_54_52-SQLQuery4.sql - not connected_ - Microsoft SQL Server Management Studio

    This is a great technique, and while it works in VSCode and some other editors, I usually have SSMS open and it works very well here. I then select all this text, paste it back into the CMD window, accept the note that this is a multi-line paste, and all my deletes run.

    2024-04-11 10_55_27-cmd

    Voila, all remote branches deleted are removed from my local git install. A few of these were already removed manually as I experimented.

    SQL New Blogger

    As I mentioned in the previous post, version control skills (especially git) are core for most technology pros. DBA, developers, sysadmin, anyone working with modern software development or administration likely needs to know about version control.

    This post was about 10 minutes. You could write this in 15 and showcase your tech skills to a future employer.

  • The Redgate Seminar – Brisbane

    On Thursday, May 2, we have the Redgate Seminar in Brisbane. I’ll be at there along with fellow Redgate engineers, account executives, Octopus Deploy engineers, fellow Microsoft MVPs, and lots of data professionals.

    Come join me and we’ll have a great day talking about End to End Database DevOps across a number of sessions and discussion panels.

    Don’t miss the day and register today.

  • A New Word: the standard blues

    the standard blues– n. the dispiriting awareness that the twists and turns of your life feel new and profound, but are not unique – marked by the same coming-of-age struggles as millions of others, the same career setbacks, the same family strife, the same learning curve of parenting – which makes even your toughest challenges feel harmless and predictable, just another rename of the same old story.

    In many ways I relate to the standard blues, though I don’t find them blue, but comforting. I was at dinner with our volleyball team and their parents. One of the other sets of parents had a 4-year old, who struggled to sit still and made dinner a challenge.

    I remember those days. Remember feeling this is way harder for me and my wife than others. Especially when we had 2 little ones, and everyone else didn’t. However, over time I realized that it was new and hard to me, but it’s the same thing others went through. I still see that today with parents on that part of their journey.

    I think a lot of things that feel tough in life, stress over finding a job, over your first review, over purchasing a house or car, are not that tough a challenge as they feel in that moment. They are just a new experience for you.

    Even when my father passed, it was a shock, but I took comfort from others that had gone through the same thing, and from the knowledge that it’s a part of life.

    Sometimes events are blue, and sometimes they are just new events. Fortunately most of the time they aren’t as unique or hard over time as they are in the moment.

    From the Dictionary of Obscure Sorrows

  • Vacation After Time Travel

    It’s Wednesday. However, it feels like Tuesday. I left Denver about 25 hours ago to fly to LA and then Sydney. It feels like one day, but by crossing the international date line, I lost a day.

    Don’t worry, I’ll get it back when I come home in a couple weeks.

    Today starts vacation for my wife and I. We’ll enjoy some time in Sydney and Brisbane before I go to work next week.

    No much blogging until then, apart from a new word Friday Winking smile