Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Substitute PROXY-HOSTNAME with the hostname of the HTTP(S) proxy server, and PROXY-PORT with the port of the HTTP(S) proxy server. When using the credential manager on Windows, the proxy must be specified scheme first (e.g. http://).

How do I add an alias for a command?

...

If you are using Git version 2.24 or newer you can also use the command: git switch --create <NAME-OF-BRANCH>

How do I remove a local branch?

Code Block
$ git branch -D <NAME-OF-BRANCH>

What should I name my local branches?

...

If you are using the Skara CLI tools then and have the branch you want to publish currently checked out, then you can just run the command git publish

Commits

How do I

...

remove a

...

remote branch?

...

Code Block
$ git push --delete origin <NAME-OF-BRANCH>

Note: the above command assumes that the branch exists in the remote repository that origin is referring to.

How do I merge commits from another branch into the current branch?

Code Block

First ensure that you have configured your full name, email and editor. You must then add the files that you want to be part of the commit (even files that are already tracked by Git):

bash
Code Block
language
$ git add path/to/file1 path/to/file/2

You can inspect the changes that will be part of the commit by running the following command:

merge <OTHER-BRANCH>

How do I view commits on the current branch but exclude ones on the master branch?

Code Block
Code Block
languagebash
$ git difflog --staged

You can then create the commit by running the following command:

Code Block
languagebash
$ git commit

The above command will open your editor where you willl the commit message. If the commit message only is a single line then you can pass it directly to commit command: git commit -m 'Your commit message'.

How can I see information about a commit?

graph --pretty=oneline --first-parent --abbrev-commit master..HEAD

Commits

How do I make a commit?

First ensure that you have configured your full name, email and editor. You must then add the files that you want to be part of the commit (even files that are already tracked by Git):

Code Block
languagebash
$ git show <COMMIT>

Can I update a commit with more changes?

Yes, but you will be mutating history. If you have already pushed the commit, then other people might depend on the commit you are about to mutate. If you have only pushed the commit to your personal fork and you are not currently collaborating with someone, then it is fine to mutate the history (you yourself are the only one who will be affected). If you have pushed the commit to a project repository, then it is not fine to mutate history, since you cause problem for other contributors.

In many cases, for example when working on a pull request, you can just make an additional commit and push it. The Skara integrate command will squash (collapse) the commits in the pull request into a single commit before integrating it, so the final result will be as if you only had made one commit.

If you still want to mutate history and update the last commit, first add the files you want to add to the commit:

Code Block
languagebash
$ git add path/to/file1 path/to/file2

Then run the following command to amend the HEAD commit:

Code Block
languagebash
$ git commit --amend --no-edit

GitHub

Configuration

How do I setup two-factor authentication (2FA)?

add path/to/file1 path/to/file/2

You can inspect the changes that will be part of the commit by running the following command:

Code Block
languagebash
$ git diff --staged

You can then create the commit by running the following command:

Code Block
languagebash
$ git commit

The above command will open your editor where you willl the commit message. If the commit message only is a single line then you can pass it directly to commit command: git commit -m 'Your commit message'.

How can I see information about a commit?

Code Block
languagebash
$ git show <COMMIT>

Can I update a commit with more changes?

Yes, but you will be mutating history. If you have already pushed the commit, then other people might depend on the commit you are about to mutate. If you have only pushed the commit to your personal fork and you are not currently collaborating with someone, then it is fine to mutate the history (you yourself are the only one who will be affected). If you have pushed the commit to a project repository, then it is not fine to mutate history, since you cause problem for other contributors.

In many cases, for example when working on a pull request, you can just make an additional commit and push it. The Skara integrate command will squash (collapse) the commits in the pull request into a single commit before integrating it, so the final result will be as if you only had made one commit. If you mutate history in an active pull request, it will make it much harder for reviewers to follow the changes.

If you still want to mutate history and update the last commit, first add the files you want to add to the commit:

Code Block
languagebash
$ git add path/to/file1 path/to/file2

Then run the following command to amend the HEAD commit:

Code Block
languagebash
$ git commit --amend --no-edit

GitHub

Configuration

How do I setup two-factor authentication (2FA)?

https://help.github.com/en/github/authenticating-to-github/securing-your-account-with-two-factor-authentication-2fa

How do I generate a personal access token (PAT)?

Go to https://github.com/settings/tokens and and click on "Generate new token"

How do I upload an SSH key to my GitHub account?

https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account

Personal Forks

What is a personal fork?

A personal fork is a copy of another repository with one major difference:

  • you can use a pull request to suggest that some changes from your personal fork should be incorporated into the original repository the fork was created from

How do I create a personal fork?

...

...

...

How do I generate a personal access token (PAT)?

Go to https://github.com/settings/tokens and and click on "Generate new token"

How do I upload an SSH key to my GitHub account?

...

...

...

...

...

...

...

...

...

...

How do I sync my personal fork with the original repository it was created from?

Assuming you have a local clone of your personal fork and you are using the Skara CLI tools:

Code Block
languagebash
$ git sync

If you also want to sync your personal fork and your local clone of your personal fork and you are using the Skara CLI tools you can run:

Code Block
languagebash
$ git sync --fast-forward

If you do not have the Skara CLI tools installed and you have a local clone of your personal fork, you need to the following steps:

Code Block
languagebash
$ git remote add upstream <URL-FOR-ORIGINAL-OPENJDK-REPOSITORY>
$ # for each branch you want to sync
$ git checkout <BRANCH>
$ git pull upstream <BRANCH>
$ git push origin <BRANCH>

Pull Requests

What is a pull request?

A pull request is a way to suggest that some changes from a personal fork should be incorporated into the original repository the personal fork was created from. Reviewers can comment upon and need to approve a pull request before it can be integrated. The concept of a pull request is very similar to OpenJDK's concept of "RFR" emails - both are used to suggest changes and offer a way for reviewers to provide feedback on the suggested changes.

How do I create a pull request?

What is a draft pull request?

A draft pull request is a pull request that is not yet ready for review. Draft pull requests are primarily used to share work in a early stage or run additional testing before declaring the pull request ready.

How do I create a draft pull request?

  • If you are using a web browser, click the downwards pointing arrow on the green "Create Pull Request" button and choose "Create Draft Pull Request":
    Image Added
  • If you are using GitHub CLI, provide the --draft flag to gh pr create.
  • If you are using the Skara CLI tools, provide the --draft to flag to git pr create.

How do I transition a pull request from draft to ready for review

...

Personal Forks

What is a personal fork?

A personal fork is a copy of another repository with one major difference:

  • you can use a pull request to suggest that some changes from your personal fork should be incorporated into the original repository the fork was created from

How do I create a personal fork?

How do I sync my personal fork with the original repository it was created from?

Assuming you have a local clone of your personal fork and you are using the Skara CLI tools:

Code Block
languagebash
$ git sync

If you also want to sync your personal fork and your local clone of your personal fork and you are using the Skara CLI tools you can run:

Code Block
languagebash
$ git sync --fast-forward

If you do not have the Skara CLI tools installed and you have a local clone of your personal fork, you need to the following steps:

Code Block
languagebash
$ git remote add upstream <URL-FOR-ORIGINAL-OPENJDK-REPOSITORY>
$ # for each branch you want to sync
$ git checkout <BRANCH>
$ git pull upstream <BRANCH>
$ git push origin <BRANCH>

Pull Requests

What is a pull request?

A pull request is a way to suggest that some changes from a personal fork should be incorporated into the original repository the personal fork was created from. Reviewers can comment upon and need to approve a pull request before it can be integrated. The concept of a pull request is very similar to OpenJDK's concept of "RFR" emails - both are used to suggest changes and offer a way for reviewers to provide feedback on the suggested changes.

...

?

What is a draft pull request?

...

  • run git pr set --no-draft.

How do I

...

change the title of a

...

pull request?

  • If you are using a web browser, click the downwards pointing arrow on the green "Create Pull Request" button and choose "Create Draft Pull Request":
    Image RemovedIf you are using GitHub CLI, provide the --draft flag to gh pr create."Edit" button to the right of pull request's title:
    Image Added
  • If you are using the Skara CLI tools, provide the --draft to flag to git pr create.

How do I transition a pull request from draft to ready for review?

  • run git pr set --title='New title'.

What is the pull request body?

The body, or description, of a pull request is the initial comment in the pull request. Can be compared to the body of the initial "RFR" email.

How do I change the body of a pull request?

How do I

...

modify the changes in a pull request?

To modify your patch in a pull request

...

  • If you are using a web browser, click the "Edit" button to the right of pull request's title:
    Image Removed
  • If you are using the Skara CLI tools, run git pr set --title='New title'.

What is the pull request body?

The body, or description, of a pull request is the initial comment in the pull request. Can be compared to the body of the initial "RFR" email.

How do I change the body of a pull request?

...

, just push more changes to the branch the pull request is based on. Avoid modifying changes that are already part of the pull request branch or force pushing unrelated changes as that will mess up the pull request and make it hard for reviewers to make sense of it. When Skara integrates the pull request, all the changes will be squashed into a single change anyway.

How do I update a pull request with upstream changes?

If your pull request slips too far behind the target branch (e.g. the master branch in the mainline jdk repository), you will need to pull in changes from master and resolve any conflicts before you can integrate. When doing so, it's usually preferred to merge the changes rather than rebasing, especially if the reviews have already started on the pull request. If changes are rebased, the history in the pull request becomes problematic and hard to follow for reviewers. When Skara integrates the pull request, all the changes will be squashed into a single change anyway

...

.

Repositories

Can Committers for a project push directly to the project repository?

...