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 votes

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
Community showcase
Published Mar 14, 2019 in Bitbucket Pipelines

Building a Bitbucket Pipe as a casual coder

...ipe.sh :  #!/bin/bash source "$(dirname "$0")/common.sh" enable_debug extra_args="" if [[ "${DEBUG}" == "true" ]]; then extra_args="--verbose" fi # mandatory variables R...

265 views 0 12
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