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

This widget could not be displayed.

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.

This widget could not be displayed.

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
Community showcase
Published Aug 21, 2018 in Bitbucket

Branch Management with Bitbucket

As a project manager, I have discovered that different developers want to bring their previous branching method with them when they join the team. Some developers are used to performing individual wo...

1,352 views 8 11
Read article

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