Current section: Real World Examples 15 exercises

Simplifying Git Commit Messages

Writing good git commit messages used to be a time-consuming task, but not any more!

AI assistants are able to generate commit messages for you based on the actual git diffs.

GitHub Copilot has a built-in button that will do this for you, but you can also use other AI assistants to generate commit

Loading lesson


00:00 So I've made a couple of changes here and I want to commit those. So if we go over to our source control right here, we can take a look at the diff. And I could write this myself, but we have AI assistants who can help us with that. So I can literally just click on this button and chat,

00:14 and GPT will be, or whatever AI assistant, a co-pilot is using OpenAI. But whatever other AI assistant you have can generate this commit message based off of the git diff. So here it's saying refactor query to use user index route, or whatever.

00:32 If you're not happy with it, you can just try it again and boom, it's going to give you more and more. So you can use AI to help you write your commit messages. If you don't have some cool extension or whatever that has a cool little button, you can actually still make this work.

00:48 So what you could do is, let's do a git diff, and we'll pipe that into pb copy. And then we'll go over to chat GPT, we'll say please write a commit message for this.

01:07 And there we go. And it will write us a nice commit message for the diff, which is awesome. And so then you could wire this up to whatever other assistant that you have to pipe that information and have like a quick little script that'll handle git diff,

01:25 write commit message, and even make the commit if you wanted to. So I do occasionally use our AI assistants to help me write commit messages, so I don't have to bother with it, and yeah, they're actually pretty good.