Tag: Git

  • AutoCorrect in Git

    I can’t believe autocorrect is available, or that I didn’t know it existed. I should have looked, after all, git is smart enough to guess my intentions. I learned this from Kendra Little, who made a quick video on this. She got it from Andy Carter’s blog.

    Let’s say that I type something like git stats in the cmd line. I’ll get a message from git that this isn’t a command, but there is one similar. You can see this below.

    2020-12-04 11_32_06-cmd (Admin)

    However, I can have git actually just run this. If I change the configuration with this code:

    git config --global help.autocorrect 20

    Now if I run the command, I see this, where git will delay briefly and then run what it things is correct.

    2020-12-04 11_34_45-cmd (Admin)

    The delay is controlled by the parameter I passed in. The value in in tenths of a second, so 20 is 2 seconds, 50 is 5 seconds, 2 is 0.2 seconds, etc.  If you set this back to 0, autocorrect is off.

    A great trick, and one I’d suggest everyone enable.

  • Git Tricks–Getting a New Remote Branch–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    This is probably more for me than anyone, but as I’ve been working in more team demos, I find I need to up my git skills. In this case, a fellow team member created a new branch, and I needed to get it on my local machine.

    I know many git clients will make this easy, but I always like to see what happens at the CLI. This keeps my skills fresh, and I can see all the git output, some of which might be hidden in a client.

    In this case, the team member had created a branch on Github. I’ll demo this by creating my own branch as feature/demotest. I see the branch online.

    2020-08-18 15_30_25-way0utwest_dbascripts at feature_demotest

    However, I don’t see it locally.

    2020-08-18 15_31_00-cmd

    If I know the name, I get fetch this, or pull it, from the remote. In this case, either of these code items will work.

    git pull origin feature/demotest

    or

    git fetch origin feature/demotest

    Once I do this, I can checkout the branch, which will match the remote with this code:

    git checkout feature/demotest

    2020-08-18 15_32_56-cmd

    Now it’s a branch that is tracking the remote with my local copy.

    SQLNewBlogger

    This was a quick Google search to figure out how to do this, but since I’ve had to search a couple times in the last month, I decided to write this and cement the knowledge in my head. At least, I hope it does.

    This took about 5 minutes to write and demo. A quick thing, but a good way to show some learning and knowledge on your blog.

  • Choosing a VCS

    As someone that speaks and promotes DevOps, I get asked for recommendations and specifics all the time for tooling. One of the questions I’ll get asked regularly is about version control. First, use it. There’s no excuse for not using version control these days, especially as most of the software out there is free.

    My view is that Git is really the choice these days. Most IDEs and software tools work with git, and if they don’t, likely they don’t support version control. While there are lots of choices out there, and I’ve used a lot in my career, it seems that Git has really won and is the default choice for so many organizations. What’s interesting is so many of the surveys and tracking of version control systems tend to rank the most often used hosting services, all of which use Git.

    However, does that mean you should abandon your existing TFVC, SVN, or other system for Git? I wouldn’t necessarily recommend that, but I would start learning Git and considering it for new projects. Some people love the change, others see TFVC with more complexity, and many people recommend moving away from TFS. I see similar thoughts about SVN and other VCS systems. Even this svn v git site that links to repo stats shows the stated stats of 47% of projects on SVN v 38% for git is outdated. As I write this, it’s 71% on git. I think that’s a testament to the growth from 2016 to now in Git’s popularity.

    What would I choose today? Git, hands down, for any project at any company. I might live with the existing system in the short term, but I’d be thinking git, if for no other reason than future hires and staff will likely be more familiar with git than anything else. I’d move in that direction. I don’t know I’d spend time converting existing repositories to git, but if the need arose, I’d be ready to do so.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher or iTunes.

  • Delete a 2020 GitHub Repository–#SQLNewBlogger

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    I have a lot of GitHub repos, sometimes just set up to test something. Recently I wanted to delete one, but most of the docs on the Internet were out of date. So I wrote this one.

    The help docs say to find the Danger Zone for your repo. I didn’t see this as an item under Settings. Instead, I see this.

    2020-06-09 19_35_56-Options

    However, the docs talk about access, so I decided to check the “Manage Access” item on the left. I see options, and since this is a public repo, I see the “Manage” link.

    2020-06-09 19_37_12-Manage access

    This actually scrolls me down, which I might have figured out, but in my view, I didn’t see any obvious idea that there was more below the settings. Instead, I find the Danger Zone.

    2020-06-09 19_37_54-Options

    Here I can click “Delete this repository” and it’s gone. Well, it’s gone if I confirm I know bad things happen here.

    2020-06-09 19_38_52-Options

    Be super sure and super careful with this. Be sure you know what happens. If you do this to a private repo, forks go away. That could be really bad in an org.

    SQLNewBlogger

    If you build software, employers want to know how you build software. This post took me 10 minutes to write, and gives someone interviewing me the chance to ask me questions. How, why, etc.

    You can do this for your own reasons.