Skip to content

Smart Commits


Overview

  1. We work on branches for any issue/tasks/bugs that are issued on some sort of kanban board.
  2. Such board have issue number to track the issue. In addition to those a special feature SMART COMMIT is integrated into Jira.
  3. Smart branching and smart commits helps to keep in track of the issue and its associated branch.

How to ?

  1. Branch out with that track number as the name of the new branch

    • Syntax: git checkout -b "<issue-id>"
    • Example: git checkout -b "sn-135"

    this will create a link on the jira ticket after the branch gets pushed to remote.

  2. While putting commit on a staged changes, there is a convention that'll put the message written in commit section to the issue ticket as a comment.

    • Syntax: git commit -m "<issue-id> #COMMENT <comment-message>"
    • Example: git commit -m "sn-135 #COMMENT reworked on the algorithm to pickup stuffs."

    what this will enable is a easy tracking of tasks and the branch that we are working for the issue on and their equivalent COMMITS, all through the convenience of tickets in the board.
    No need to go through all the branches in git history and find commit heads with the required commit message.

    Create Project

    Fig 1: After smart git commit similar thing can be seen on jira ticket

Conclusion

If somebody has ever searched for code of a feature branch thats been merged, using the old commits for some of the diagnostics, s/he sure will know the hassle with it. With smart commit and branching, that problem will be long gone.


  1. Contributors: Sanjog Thapa