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.
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
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>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Many thanks @Julius Davies [bit-booster.com]!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.