This is another common simple day to day task for many developers. But, in my case the “do everything IT guy – IT Handyman” I keep forgetting how to create a new github branch using the Terminal.

So, I decided to put this in writing and hopefully help someone else. But, first I needed to brew one of my favorite coffee at home using one of coffee brewing methods for home baristas.

o create a new GitHub branch for your project, follow these steps:

1. Open Your Terminal or Command Prompt

Navigate to the folder where your GitHub project is located.

2. Check the Current Branch

Use this command to see the branch you’re currently working on:

git branch

The active branch will be marked with an asterisk (*).

3. Create a New Branch

To create a new branch named your-branch-name, run:

git branch your-branch-name

4. Switch to the New Branch

Move to the new branch with:

git checkout your-branch-name

Alternatively, you can combine steps 3 and 4 using:

git checkout -b your-branch-name

5. Push the Branch to GitHub

Once you’ve made changes and committed them, push the branch to GitHub:

git push -u origin your-branch-name

Verify the Branch Exists on GitHub

Visit your GitHub repository to ensure the branch is listed under the “Branches” tab.

Check out my shop

Leave a comment

Your email address will not be published. Required fields are marked *