Blog posts (page 5)

  • Advent Day 22: libgit2 and Friends
    I love scripting against my git repository. Often I'll have an idea for a quick and dirty tool that will help me get my work done - for example, git recover, which helps you locate files that were accidentally deleted from your working tree that never got checked in. But scripting against git generally means writing Bourne shell scripts and parsing text output. That's fine for simple jobs, but it gets frustrating quickly if you're trying to do something more complicated. That's when I reach for libgit2.
    Read more
  • Advent Day 21: Renormalizing Line Endings
    This month I've given a few tips and tricks that I think are important - for example, getting your line ending configuration right. But a lot of these settings require you to get them set up in the initial commit, ideally before you start adding content to your repository. But development - like most of life - isn't always so simple. What if you've already committed changes? And you've been using core.autocrlf inconsistently, instead of using a .gitattributes? So you've got a mix of line endings in your repository? Thankfully, that's an easy fix.
    Read more
  • Advent Day 20: Force with Lease
    I've highlighted a few Git GUI clients this month: GitKraken, which supports macOS, Windows and Linux, and Tower, which supports both macOS and Windows. But today I want to mention a surprising GUI client: Working Copy. It's surprising because it's not a GUI client for a "proper" computer, it's a GUI for ... your phone.
    Read more
  • Advent Day 19: Working Copy
    I've highlighted a few Git GUI clients this month: GitKraken, which supports macOS, Windows and Linux, and Tower, which supports both macOS and Windows. But today I want to mention a surprising GUI client: Working Copy. It's surprising because it's not a GUI client for a "proper" computer, it's a GUI for ... your phone.
    Read more
  • Advent Day 18: Conditional Includes
    If you're a professional programmer who also works on open source software, then you might want to keep your work identity a bit separate from your personal identity. For example, I always use my personal email address when I'm working on my personal projects and open source software. In contrast, I always use my work email address when I'm committing to my work repositories. At least, I try to always do that. One of the things that helps ensure that I keep this organized is Git's conditional includes.
    Read more
  • Advent Day 17: Whitespace in GitHub Pull Requests
    I hope that I've encouraged you to get your .gitattributes set up correctly so that everybody on your team is committing with the same line ending configuration. But maybe you haven't had time to fix that yet, maybe you're on holiday, or, heck, maybe you don't even care... 🤯 Even if some people on your team are still committing files with CRLF line endings, while others are committing with LF; some tools like GitHub have you covered.
    Read more
  • Advent Day 16: All Things Git
    I hope you'll allow me a moment of shameless self-promotion: one of the great luxuries of my job is that I've been able to meet so many great people who are working on development tools, on helping people use version control, and to be better software developers in general. And since I have so many great conversations with people, I decided to start recording them, along with my buddy Martin. The result is our podcast: All Things Git.
    Read more
  • Advent Day 15: Tower
    Earlier this month, I suggested GitKraken as a graphical Git client. But just like you might prefer spaces over tabs (gasp!) or dark themes over light ones (what!?!), different people have different preferences when it comes to their Git clients, and I'd encourage you to try a few to find the one that you like. Another great one is Tower.
    Read more
  • Advent Day 14: gitattributes for Binary Files
    Earlier this month, I talked about using .gitattributes to handle text files. And I talked about using Git LFS for large files. But what if you have small binary files that aren't so large that they warrant using Git LFS, and you want to keep them in the repository?
    Read more
  • Advent Day 13: Setting Files Executable on Windows
    When you're working on cross-platform projects, you often want to create a single set of scripts that works on all the platforms that you're targeting: Linux, Windows, macOS, maybe even some more exotic or legacy Unix systems. There are a number of scripting languages that will work on all of those: but whatever scripting language you choose, one thing is certain: you'll need to set those files executable on Unix platforms, and that's simply not a concept that exists on Windows. So if you're creating new scripts on Windows, you'll need to find a way to set those files executable when you commit them to support running the scripts on Unix machines. Thankfully, Git has you covered.
    Read more