Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get commits history for one file in gitlab api?

Tags:

gitlab

api

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?

like image 530
zhanxin.lin Avatar asked Sep 06 '15 14:09

zhanxin.lin


People also ask

How do you get commit history in Gitlab?

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.

Where is git commit history stored?

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.

How do you check all commits in Gitlab?

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.


2 Answers

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

like image 56
marcus Avatar answered Oct 19 '22 04:10

marcus


Now you can do:

/projects/:id/repository/commits?path=:file_path

and receive array of commits about specific file.

Link to documentation

like image 23
Caio Costa Avatar answered Oct 19 '22 03:10

Caio Costa