Pushing Changes Using Git

Normal git command line can be used for committing and pushing changes to gerrit.



Cloning Git Repostirories

  1. The git clone command can be found on each project's gerrit page. For example, the project page for appc is located here: https://gerrit.onap.org/r/#/admin/projects/appc

  2. The "Clone with commit-msg hook" option should be selected and then either the "http" or "ssh" option should be selected.

  3. The "git clone...." command, located just below these options, can then be copied into your command line



Making Commits

  1. Use git add <file name> to stage changed files for commit

  2. Commit the changes using: git commit -m "<name of the commit / first line of commit message>"

  3. git commit -s --amend will sign off the commit with your username and then will open up the commit message editor

    1. You will see a paragraph that contains the "Change-Id" and "Signed-off-by". Add a new line to this paragraph with the following:

    2. Issue-ID: <Jira issue id>

    3. The capitalization of the "Issue-ID" text must be exact

    4. The Jira issue id should match a valid Jira issue. For example "APPC-123" or "OOM-123" are valid issue ids.

    5. While the commit message editor is open, you can also add additional text to your commit message if you want

  4. To push the commit to gerrit, use the git push origin HEAD:refs/for/master command

    1. Normally you should be pushing to master, but if you need to push to a branch other than master, the "master" word can be replaced.

    2. For example, if you're pushing to Dublin branch: git push origin HEAD:refs/for/dublin