I want to get the commits or the last commit for one file in gitlab api like this:
GET /projects/:id/repository/commits?path=fileName
Gitlab support or not?
Git file History provides information about the commit history associated with a file. To use it: Go to your project's Repository > Files. In the upper right corner, select History.
Git stores the complete history of your files for a project in a special directory (a.k.a. a folder) called a repository, or repo. This repo is usually in a hidden folder called . git sitting next to your files.
Under the activity tab , there should be a subtab just for 'commits' that lists all commits to the project as they are happening. Or under the repository tab, and commits subtab, users should be able to choose 'all' under the branch drop down.
There is a patch that implements this feature:
https://gitlab.com/gitlab-org/gitlab-ce/issues/18898
Unfortunately, it has not been merged yet:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4814
Edit: now merged, expected to land in 8.14.0 (2016-11-22): https://gitlab.com/gitlab-org/gitlab-ce/commit/146d4348ca6812e26729de40a831f4ae8c27fde6
Now you can do:
/projects/:id/repository/commits?path=:file_path
and receive array of commits about specific file.
Link to documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With