Author: way0utwest

  • 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.

  • Action Over Knowledge

    I saw a quote recently that resonated with me. It’s not something I’ve often struggled with, but I have at times. Here’s the quote:

    “Life rewards action, not intelligence. Many brilliant people talk themselves out of getting started, and being smart doesn’t help very much without the courage to act. You can’t win if you’re not in the game.” – @JamesClear

    Part of my goals in life are to help others and motivate them to engage in life and drive themselves forward. I have tried to motivate my children, I work with kids I coach to grow and change, and I (think) write about this often here. I want you to take charge of your career and life and drive it forward in the way that works for you.

    However, you have to work at things. The quote above notes that it’s not how smart you are, but having success in life comes from action. From doing something. From making efforts. The last part is the most important, if you don’t engage and become part of your game, your life, you can’t win or achieve your goals.

    As Ferris Bueller said, life can move pretty and you can miss it if you’re not paying attention. As I get older, that means more to me. Life slips by, days, weeks, months, even years seem to fly by. Especially after the pandemic, where I see someone and realize it hasn’t been a year or two since I’ve seen them but four years.

    You don’t have to be extremely driven and type A. I think I might be a little too driven at times, living in chaos, but I met someone recently who spent more than 5 years trying to transform a company. This individual worked their job, spent nights and weekends trying to learn more about their business, and drove themselves and others well beyond what I’d consider a balance in life. They were working well over 60 hours a week for years, as were some employees. I don’t think that’s a great way to live, and whether it’s work, hobbies, or something else, forgetting to balance the various parts of your life isn’t good.

    At the same time, inaction, not trying to grow, learn, practice, or even attempt something new in any part of your life isn’t good either.

    Work on your career and skills but balance that with the time you need away from work. Invest in your education to change careers if you like, but don’t plan on working what is essentially two jobs to become a way of life. At least not for too many years. Enjoy your hobbies, but remember there is family at home that deserves and needs your time as well. Find ways to engage in life, but in a way that respects all the commitments to work, family, friends, faith, hobbies, and yourself. Especially don’t forget about taking care of yourself.

    Effort is often more important than the short-term results. Just being engaged and in the game gives you a chance of success, but more, it allows you to enjoy the ride. Just do so in a balanced way.

    Steve Jones

    Listen to the podcast at Libsyn, Spotify, or iTunes.

  • 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