Skip to content
GitLab
Next
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Primary navigation
Search or go to…
Project
GitLab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Privacy statement
Keyboard shortcuts
?
What's new
4
Snippets
Groups
Projects
Show more breadcrumbs
GitLab.org
GitLab
Commits
a0fd1031
There was an error fetching the commit references. Please try again later.
Verified
Commit
a0fd1031
authored
6 days ago
by
Brendan Lynch
Committed by
GitLab
6 days ago
Browse files
Options
Downloads
Patches
Plain Diff
Add reference to use HEAD as ref value
parent
d1e8eb08
No related branches found
No related tags found
2 merge requests
!181780
Add reference for HEAD as ref value
,
!180727
Resolve "Extend job archival mechanism to the whole pipeline"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/api/repository_files.md
+10
-2
10 additions, 2 deletions
doc/api/repository_files.md
with
10 additions
and
2 deletions
doc/api/repository_files.md
+
10
−
2
View file @
a0fd1031
...
...
@@ -46,7 +46,15 @@ curl --header "PRIVATE-TOKEN: <your_access_token>" \
|-------------|----------------|----------|-------------|
|
`id`
| integer or string | yes | The ID or
[
URL-encoded path of the project
](
rest/_index.md#namespaced-paths
)
. |
|
`file_path`
| string | yes | URL encoded full path to new file, such as
`lib%2Fclass%2Erb`
. |
|
`ref`
| string | yes | The name of branch, tag or commit. |
|
`ref`
| string | yes | The name of branch, tag or commit. Use
`HEAD`
to automatically use the default branch. |
If you don't know the branch name or want to use the default branch, you can use
`HEAD`
as the
`ref`
value. For example:
```
shell
curl
--header
"PRIVATE-TOKEN: "
\
--url
"https://gitlab.example.com/api/v4/projects/13083/repository/files/app%2Fmodels%2Fkey%2Erb?ref=HEAD"
```
### Response
...
...
@@ -116,7 +124,7 @@ GET /projects/:id/repository/files/:file_path/blame
|
`id`
| integer or string | yes | The ID or
[
URL-encoded path of the project
](
rest/_index.md#namespaced-paths
)
. |
|
`range[end]`
| integer | yes | The last line of the range to blame. |
|
`range[start]`
| integer | yes | The first line of the range to blame. |
|
`ref`
| string | yes | The name of branch, tag or commit. |
|
`ref`
| string | yes | The name of branch, tag or commit.
Use
`HEAD`
to automatically use the default branch.
|
|
`range`
| hash | no | Blame range. |
```
shell
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment