How to specify branch name in commits history


When two developers work on a feature branch and they both commits their changes (with conflict resolved) to the feature branch. However, in Stash commits section, there is a column "issues" and we found that not all commits are marked with the name of the branch (e.g if I create a branch with name feature-12-add_value, "issues" sometimes mark "feature-21" for initial commit )

It is hard for us to determine which commits relating with a feature branch if we cannot see any remark on it.

Does anyone know how to help on this problem ?



2 answers

0 vote

The ids in the issues column are picked up from the commit message, not from the feature branch name. You can include multiple issue keys, in a single commit, and you will see all of them listed in that column irrespective of the feature branch name.

Just make sure you have the issue key on all commits.

Git doesn't track which branch a commit was on after it's been merged.  In fact, this distinction is meaningless to git.  After a merge, you have a new commit that has two parent commits.  Both parent commits are now equally part of the branch's history.  This is, as you've discovered, often at odds with our intuitive understanding of how branching and merging works. 

As Jobin notes, the only source of information Git and therefore Stash has is what's contained in the comments and you should put issue IDs there if it's important to you to be able to track them.  There are a number of plugins for Stash that allow you to enable hooks to reject pushes if the commits don't contain a JIRA ID or match some other defined regexp.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

25,218 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you