You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Repositories

Branches

How do I create a local branch?

$ git checkout -b <NAME-OF-BRANCH>

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

What should I name my local branches?

A common way of structuring your local branches is to name them after the issue they correspond to, for example JDK-8237566.

How do I list local branches?

$ git branch
  JDK-8237566
* JDK-8149128
  JDK-8077146
  master

How do I switch to another branch?

$ git checkout <NAME-OF-OTHER-BRANCH>

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

  • No labels