Search code examples
gitlabchangelog

GitLab output for the commit history


Scenario #1: I am using this static URL to append to my JIRA ticket that redirects me to all commits in that version specifically.

//-/commits/release/

But this gives me all the logs including the previous one. that is in the previous version, technically this is right and the GitLab redirections show all in the previous commits history items.

But the requirement is to stop at the branch not to show from start but only from the branch created.

Scenario #2: So I started using Gitlab API and if I call this API I get JSON that I need to parse and attached to Jira ticket.

/api/v4/projects//repository/commits?ref_name=.

Issue here: I wanted to follow the above link approach to attach in Jira to any changes that happened after the file attached with change logs as GitLab API called I can see them directly and not to maintain file adding for new changes program.

Can seek help what URL can I use that will not show me old GitLab commits other than all history from the time branch was cut-off and not from start.

Sample given: Scenarios #1 : gives good Gitlab UI with all logs shows in Commit section

Commit #100 Commit #99 . . . .Commit #88 (When this branch was created) .Commit #87 .Commit #86 . . ..Commit #01 (This is till I see more on loading which I don't want and want to stop at Commit #88 when the branch was created.

Scenario #2 Using Gitlab API I get the right data, but then I have to dump the file during the call, and there may be additional changes afterward in a week before the next branch cutoff is scheduled that I can get missed, hence wanna use by reference as a scenario on without load more records of older branches.

API returns only this but has to create a file and attached it as stale records.

Commit #100 When i call API Commit #99 . . . .Commit #88 (When this branch was created)

enter image description here


Solution

  • You can use the compare API to get just the commits for a particular branch/tag/release.

    Because commits can be shared across many branches, this is probably the most reasonable way to do this, but you will need to choose a branch for reference in the comparison; probably main/master.