Mastering GitHub Branches: 10 Tips for Effortless Branch Management

Create a New Branch on GitHub

On GitHub, go to your repository and click the “master” branch button.

From where you can create a new Branch. Type in a descriptive name, and click Create branch:

The branch should now be created and active. You can confirm which branch you are working on by looking at the branch button. See that it now says “branch-2” instead of “main”.

Git switch branch

Start working on an existing file in this branch. Click the “demo.java” file and start editing:

After you have finished editing the file, you can click the “Preview” tab to see the changes you made highlighted:

preview tab after changes on branch

If you are happy with the change, add a comment that explains what you did, and click Commit changes.

commit directly on github after editing code

You now have a new branch on GitHub, updated with some changes!

visit GitHub  –Click Here