gerrit/Documentation/concept-refs-for-namespace.txt
Marian Harbach ebeb15460c Enabling linkattrs explicitly on doc pages having external links
Asciidoc may fail to render link attributes for external links
supposed to open in a new window correctly. This change adds
:linkattrs: to the beginning of such files to force parsing link
attributes correctly.

Bug: Issue 12068
Change-Id: If18be60de646ff78f672239dd4fa435fd4fd92ab
2019-12-13 10:59:57 +00:00

74 lines
1.9 KiB
Plaintext

:linkattrs:
= The refs/for namespace
When pushing a new or updated commit to Gerrit, you push that commit using a
link:https://www.kernel.org/pub/software/scm/git/docs/gitglossary.html#def_ref[reference,role=external,window=_blank],
in the `refs/for` namespace. This reference must also define
the target branch, such as `refs/for/[BRANCH_NAME]`.
For example, to create a new change on the master branch, you would use the
following command:
....
git push origin HEAD:refs/for/master
....
The `refs/for/[BRANCH_NAME]` syntax allows Gerrit to differentiate between
commits that are pushed for review and commits that are pushed directly into
the repository.
Gerrit supports using either the full name or the short name for a branch. For
instance, this command:
....
git commit
git push origin HEAD:refs/for/master
....
is the same as:
....
git commit
git push origin HEAD:refs/for/refs/heads/master
....
Gerrit uses the `refs/for/` prefix to map the concept of "Pushing for Review" to
the git protocol. For the git client, it looks like every push goes to the same
branch, such as `refs/for/master`. In fact, for each commit pushed to this ref,
Gerrit creates a new ref under a `refs/changes/` namespace, which Gerrit uses
to track these commits. These references use the following format:
....
refs/changes/[CD]/[ABCD]/[EF]
....
Where:
* [CD] is the last two digits of the change number
* [ABCD] is the change number
* [EF] is the patch set number
For example:
....
refs/changes/20/884120/1
....
You can use the change reference to fetch its corresponding commit:
....
git fetch https://[GERRIT_SERVER_URL]/[PROJECT] refs/changes/[XX]/[YYYY]/[ZZ] \
&& git checkout FETCH_HEAD
....
NOTE: The fetch command can be copied from the
link:user-review-ui.html#download[download command] in the Change screen.
GERRIT
------
Part of link:index.html[Gerrit Code Review]
SEARCHBOX
---------