The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to specify branch name in commits history

Raymond Lee
April 15, 2016

Hi,

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 ?

Thanks,

Ray

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Tim Crall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 18, 2016

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.

0 votes
Jobin Kuruvilla [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
April 15, 2016

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.

TAGS
AUG Leaders

Atlassian Community Events