Streamline Your Commit Process with Commitizen | Software Development Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone welcome back to the channel today we have an exciting topic to discuss that will make your software development workflow a whole lot easier we're going to dive into the world of committizen a tool designed to streamline your commit process and improve collaboration within your development team whether you're a junior or mid-level software engineer this is definitely a tool you'll want to know about so let's get started before we jump into the Nitty Gritty details let's start with a quick overview of comedicine in software development Version Control Systems like git are essential for managing code changes but sometimes writing commit messages that adhere to a consistent style and format can be challenging especially when you're working in a team that's where committizen comes in committizen is a command line tool that provides a simple and standardized way to create commit messages it enforces commit message conventions and helps you maintain a clean and organized commit history it gener it integrates with popular version control systems like git making it a valuable tool for any software engineer oh and it can help you generate a change log too the first step is to install kemetizen I'm going to use Homebrew for this so I'm going to type Brew install committizen but if you don't have Homebrew or prefer not to use it you can also use npm and there's a couple other package managers as well now that we've installed kamidazen we can go ahead and make a new project this one's going to be in go but you can use any language you want I'll go ahead and initialize a new git repository in this project and since it's go I'm going to use modules and we'll say go mod net and then the project great we've created a new module and a new git repo I'm going to go ahead and touch main.go to create that file and it seems like a good spot to go ahead and commit we see that we have a go mod file and a main.go but first let's use CZ and knit to initialize committizen for our project we can choose what config file we want we're just going to choose the toml file you can choose a different one if you'd prefer I like working with Tamil so we'll just use Tamil now we'll choose a commit role conventional commits is probably the most popular but you can customize your own or use one specifically made for jira there's also other plugins that you can install to give you more commit rules for now let's just use conventional commits great now we choose the source file for our version this is a little confusing but if you're using a tool like rust or PHP which has cargo files or composer files respectively you can infer the version from the version number mentioned in that file another example this is npm poetry files for Pi Project pep 621 you have a lot of options go is an interesting one where we don't have an option so I'm just going to use commitizen to manage that version the other option that we haven't mentioned yet is at the bottom SCM allows you to fetch the version from git and it doesn't need to set the version back which is kind of nice for now let's just use kemitism we'll keep this simple it couldn't find an existing tag that's because this is a brand new project so it set the tag to version 0 0 1. we can change the correct version format if we want but version itself is just it's fine for what we're trying to do so we'll leave it we can choose a version type I'm going to choose semantic versioning and we can choose to create the changelog automatically on bump and I'm going to say yes we can keep the major version 0 during breaking changes it defaults to yes I'm fine with that we can go ahead and say yes now it'll ask us what type of pre-commit hooks we want to install I'm going to pass on any of these but if you want to LIT lint your commit messages this is a great opportunity to do that as well and now you can see that we have a new command called CZ bump and it tells us that we can bump the version by running CZ bump so let's get status and see if anything's been created great we have that new CZ tomml file let's go ahead and add everything in our project and now we can use CZ commit you can see that there's a lot of different options like fix features docs Styles or factors performance test build continuous integration a lot of different options to choose from and you want to choose the one that makes the most sense for what you're committing for our sake I'm just going to put CI You could argue that this might be build as well but since we're just really trying to get the project up on GitHub this seems like a good first start now it's going to ask what the scope of the change is in our case it's the repository it's not a class or file name and we can give an imperative summary like establish Repository for go project I I probably shouldn't put that much information in there because there's a section for contextual information about the code changes and that is a great place for more information so your short imperative summary should be short but your contextual information can be quite long if you'd like it to it's going to ask if this is a breaking change we're going to say no now we have a section for the footer I'm going to say closes number one and if we push this to GitHub it's going to link our number one issue so issue number one in our commit message and whenever this gets merged we can actually have that automatically close our issue for us which is really nice great so we can see that it made some insertions and now we can run CZ changelog which will generate a changelog yep there it is if we cat that we can see hey it's unreleased well why is that let's go ahead and try to bump so we'll use CZ bump and we will see if we can bump our version that should generate a change log right we we told our cesia knit to generate a changelog when we bump so this should generate a change log we see that tag001 could not be found that's fine we saw that error message earlier we know that we're going to start with zero zero one it asks if this is the first tag created we say yes it tries to bump the version but it says no commits to bump these commits are not eligible to be bumped so let's go ahead and make one that is I'm going to fire up my editor of choice and open main.go from here I'm just going to write a really basic go program you don't need to know go to understand how this works but if you program much at all I'm sure you'll be fine figuring it out we'll declare a package called Main we'll go ahead and import fmt or font we'll Define a function for our main function and this main function is simply going to say thumped dot print line and oops the P needs to be capitalized and we'll pass in the string hello world a classic program great now we can see that we have our modified main.go file and we have an untracked changelog I'm going to go ahead and add both of these I would like to publish the changelog with my repository so let's do that now I can run CZ commit and this time we actually have a feature so let's select feature the scope of this change would be main.go and a short summary would be say hello world we can add more contextual information this is maybe a little excessive but let's say it creates a dependency on the font package from standard Library is this a breaking change no and our footer let's say it closes number two keeping those issue links going it'll make this commit for us and now if we get status we see that there is nothing on the branch to be committed now if we see Z bump we'll see the same thing before but it detects a minor increment there it is Bump version zero zero one to zero one zero and now if we LS we can see our change log our go mod and our main.go and git status as a clean Branch let's take a look at that changelog great we can see that in 0 1 0 we added a new feature called say hello world and that's in main.go now if we look at our git log we can see that there is not only the same information in our git log but there's that contextual additional information that may not be useful in a changelog but it might be useful in our code repository history again though if it is useful in your change log you can change the format that the generated changelog message is used so you could include that contextual information if you'd like but for our sake we'll just keep it with the bare minimum committezins benefits go beyond individual developers it greatly improves collaboration within development teams especially when multiple people are working on the same project when using comedicine everyone on the team follows the same commit message format which leads to a more organized and understandable commit history this consistency makes it easier to track changes identify the purpose of specific commits and as we even saw automate release notes or changelogs additionally committazen integrates well with other tools commonly used in the software development workflows for example it seamlessly works with good hooks continuous integration systems and even code review tools like GitHub or gitlab there you have it commitizen is an excellent tool for simplifying the commit process and ensuring consistent commit message formats by using it you'll not only make your life easier but also enhance collaboration within your development team remember as a software engineer mastering tools like kemetism will help you become more efficient and effective so give it a try on your next project and experience the benefits first hand that's all for today's video if you found this information useful be sure to give me a thumbs up and subscribe to the channel for more software development tips and tricks as always happy coding
Info
Channel: Brad Cypert
Views: 2,636
Rating: undefined out of 5
Keywords: commitizen, committizen
Id: lXPxE4gegdA
Channel Id: undefined
Length: 9min 54sec (594 seconds)
Published: Mon Jun 19 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.