sd

When you have a predefined process, it is generally a good idea to automate the things that can be and should be automated! In our case, we had a routine Git workflow and this post is all about creating an open source tool to solve an issue with that workflow. 

Background

Here at Leapfrog, we follow agile methodology and use an assisting project management tool called JIRA. Most of our workflow is associated around it. We create tickets for every task we need to do and those tickets have a unique code with the prefix of our projects name. For e.g: EF-1234. To solve that ticket we create a branch in GitHub with that ticket number as its name.

Now, the main problem we faced was this,  while committing changes to Git we also append the branch name with the commit message. For those who work on multiple tasks, they got confused about the branch they were in while committing. Also, it was difficult to write and match the branch name for every commit, there’s always a chance for human error.

Creating Smart Commit for Git Workflow

When we understand a problem, we consider it half solved. We knew the ticket numbers in commit messages didn’t have a consistent naming and it was difficult for developer and designers to keep up with it. So what we build was a small tool that automatically finds the current branch name and appends it to the commit message. Hence the name “Smart commit” for our Git workflow. 

Not to forget the stock terminal on windows and most of Linux shells do not show the branch name by default.  So with the added overhead the day to day workflow looked like this: 

  • Find the branch they are in with git branch
  • Copy or remember the branch name 
  • Add a commit message with the branch name without any typos. 

git workflow before smart commit

This tool doesn’t override the default git workflow i.e you still can use git commit -m. To use the smart commit, we have used the alias commit so you can feel at home while pushing the changes.

git workflow with smart commit

If your team is following the same pattern, then smart commit enables you with the best git workflow.

For those branches where you don’t need to append the current branch name, it can be written in a.smart-commit-ignore file just as a .gitignore file. Branches like “dev”, “master”, “QA”, “UAT”, and “staging” are skipped by default. The most amazing thing is, this feature was built by the Open Source community itself.

If you want to contribute, this project will always be open sourced on GitHub.

Check out more of our open source tools.

About the Author

Bimochan Shrestha is a Software Engineer at Leapfrog Technology. He is a JavaScript and Python aficionado and an enthusiastic open source contributor who loves to build tools for humans.

About Leapfrog

Leapfrog is a full stack technology services company that specializes in SaaS products, Web and Mobile Applications, and AI.
Our world-class teams have capabilities such as product design ( UI and UX), Front End and Back End Engineering, DevOps Engineering, Product Management, Data Engineering, and Machine Learning.


More in Insights

5 reasons why it’s tough for IT students to get an Internship in Nepal Technology

5 reasons why it’s tough for IT students to get an Internship in Nepal

When you have a predefined process, it is generally a good idea to automate the things that can be and

Read more
Introducing Chill, Open Source Service Monitoring Tool TechnologyTechnology

Introducing Chill, Open Source Service Monitoring Tool

When you have a predefined process, it is generally a good idea to automate the things that can be and

Read more
Introduction to Technical Debt Technology

Introduction to Technical Debt

When you have a predefined process, it is generally a good idea to automate the things that can be and

Read more