Skip to content
Snippets Groups Projects
Select Git revision
  • ag-test
  • rs-test
  • master default protected
  • test-me-pa
  • mksionek-master-patch-52381
  • new-branch-10
  • test-conflicts
  • test-suggestions
  • alejandro-test
  • patch-25
  • winh-test-image-doscussion
  • stg-lfs-image-test-2
  • stg-lfs-image-test
  • test42016
  • issue_42016
  • issue-32709
  • add-codeowners
  • ClemMakesApps-master-patch-62759
  • bvl-staging-test
  • bvl-merge-base-api
  • v9.2.0-rc6 protected
  • v9.2.0-rc5 protected
  • v9.2.0-rc4 protected
  • v9.2.0-rc3 protected
  • v9.1.4 protected
  • v9.2.0-rc2 protected
  • v9.2.0-rc1 protected
  • v9.1.3 protected
  • v8.17.6 protected
  • v9.0.7 protected
  • v9.1.2 protected
  • v9.1.1 protected
  • v9.2.0.pre protected
  • v9.1.0 protected
  • v9.1.0-rc7 protected
  • v9.1.0-rc6 protected
  • v9.0.6 protected
  • v9.1.0-rc5 protected
  • v9.1.0-rc4 protected
  • v9.1.0-rc3 protected
40 results

commits.md

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    commits.md 10.27 KiB

    Commits API

    List repository commits

    Get a list of repository commits in a project.

    GET /projects/:id/repository/commits
    Attribute Type Required Description
    id integer yes The ID of a project
    ref_name string no The name of a repository branch or tag or if not given the default branch
    since string no Only commits after or in this date will be returned in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ
    until string no Only commits before or in this date will be returned in ISO 8601 format YYYY-MM-DDTHH:MM:SSZ
    curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/5/repository/commits"

    Example response:

    [
      {
        "id": "ed899a2f4b50b4370feeea94676502b42383c746",
        "short_id": "ed899a2f4b5",
        "title": "Replace sanitize with escape once",
        "author_name": "Dmitriy Zaporozhets",
        "author_email": "dzaporozhets@sphereconsultinginc.com",
        "created_at": "2012-09-20T11:50:22+03:00",
        "message": "Replace sanitize with escape once",
        "allow_failure": false
      },
      {
        "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
        "short_id": "6104942438c",
        "title": "Sanitize for network graph",
        "author_name": "randx",
        "author_email": "dmitriy.zaporozhets@gmail.com",
        "created_at": "2012-09-20T09:06:12+03:00",
        "message": "Sanitize for network graph",
        "allow_failure": false
      }
    ]

    Get a single commit

    Get a specific commit identified by the commit hash or name of a branch or tag.

    GET /projects/:id/repository/commits/:sha

    Parameters:

    Attribute Type Required Description
    id integer yes The ID of a project
    sha string yes The commit hash or name of a repository branch or tag
    curl -H "PRIVATE-TOKEN: 9koXpg98eAheJpvBs5tK" "https://gitlab.example.com/api/v3/projects/5/repository/commits/master

    Example response:

    {
      "id": "6104942438c14ec7bd21c6cd5bd995272b3faff6",
      "short_id": "6104942438c",
      "title": "Sanitize for network graph",
      "author_name": "randx",
      "author_email": "dmitriy.zaporozhets@gmail.com",
      "created_at": "2012-09-20T09:06:12+03:00",
      "message": "Sanitize for network graph",
      "committed_date": "2012-09-20T09:06:12+03:00",
      "authored_date": "2012-09-20T09:06:12+03:00",
      "parent_ids": [
        "ae1d9fb46aa2b07ee9836d49862ec4e2c46fbbba"
      ],
      "stats": {
        "additions": 15,
        "deletions": 10,
        "total": 25
      },
      "status": "running"
    }

    Get the diff of a commit

    Get the diff of a commit in a project.

    GET /projects/:id/repository/commits/:sha/diff

    Parameters: