Forums

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

Publish List of files changed and comments on them once the code is merged in the branch

Pradbad
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 22, 2018

Hey, 
I am sure someone in this community would have already solved this issue. 

all i am trying to do is to publish list of files modified/added/deleted when a branch is getting merged with comments on the checkin. 

is there a  a easy way to di it. 

1 answer

0 votes
Mark A_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2018

Hey Pradumn,

Here are a few suggestions that may get you what you need.

Bitbucket UI

When two branches are merged from a pull request, if you are using the default merge strategy, then a merge commit would be created. You can view that commit from your repository commits or from the pull request. When viewing the pull request, you will be able to see the merge commit, message, and files. Though this is visual only and won't be beneficial if you need this exported.

Bitbucket REST API

I answered a community question on how to get all merged commits for a branch. You can view the examples but you may need to either combine or use a different rest point:

/REST/PROJECTS/{PROJECTKEY}/REPOS/{REPOSITORYSLUG}/COMMITS/{COMMITID}/CHANGES?SINCE&WITHCOMMENTS

So you can string these two together via API to pull all merged commits, and then show all changes for that commit with comments.

Resource REST API Documentation

Git CLI

Lastly, if you want to do this via command line and you know the merge commit, you can simply run:

git show <commit hash>

In the output, you can view file diffs, file name, and changes.

Resource - git show documentation

I hope that the above assists you. If there is anything that I've missed or if you have any other questions, let me know.

-Mark

Julius Davies [bit-booster.com]
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 Leaders.
March 28, 2018

You need "-m" for "git show" to show the diff with merge commits.  And "--first-parent" is a good idea since that's probably the diff you're interested in (all changes brought in with the merge).

git show -m --first-parent --name-only <commit hash>
Mark A_
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 28, 2018

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events