-1

I am new to Git and it's so confusing to me :(. I previously worked with SVN before and Git making it so tricky for me.

The master code is available on GitHub. I need to create a branch and update the code for some bugs.

I searched on web and everyone is saying I should have master checkout to my machine and then create a branch. I am not sure how this works.

Currently I don't have any code on my machine. How can I create a branch from code available in the GitHub web interface?

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Jyo the Whiff
  • 787
  • 8
  • 23
  • 3
    I respectfully suggest reading the [Git Basics chapter](https://git-scm.com/book/en/v2/Getting-Started-About-Version-Control) of the Git book. – knittl Nov 20 '21 at 15:24

2 Answers2

1

In general, you need to follow these steps:

  1. Install Git - that's a system-specific point.
  2. If needed, set up your SSH keys to access the remote repository and git credentials - that's a system-specific point too.
  3. Clone the repository using git clone <git_repo_link> (you should be able to find the command in the remote repository).
  4. Checkout to the master branch: git checkout master.
  5. Create and checkout to the new branch out of the current branch (which is master): git checkout -b my-branch-name.
  6. Now you're in the new branch and can make your own changes :x
Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
Max
  • 1,887
  • 1
  • 7
  • 14
0

To create a branch directly on GitHub, follow the instructions in Creating and deleting branches within your repository

If you need to modify code, it is better to do it in your own computer, for which you would need to use Git.

Peter Mortensen
  • 30,030
  • 21
  • 100
  • 124
daniel
  • 66
  • 3