How to specify branch name in commits history

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,940 views 1 5
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