Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preparation 2: Create your own branch #5

Open
huw-rhys-jones opened this issue Jun 19, 2023 · 0 comments
Open

Preparation 2: Create your own branch #5

huw-rhys-jones opened this issue Jun 19, 2023 · 0 comments
Assignees
Labels

Comments

@huw-rhys-jones
Copy link
Owner

Git repositories such as this one are usually divided into branches. You can probably guess what a branch is from the name - it's a splitting off of the code along another path. To use a gaming analogy, different branches can be thought of as different play throughs of the same game. Of course we can go back to an earlier saved game and start a new branch from there, maybe going a completely different direction. The big difference is that diverging Git branches can be merged together again later, but we'll talk about that later.

Git branches allow us to do a few useful things which you can probably guess a few of. They allow us to:

  • Test out different approaches to a problem
  • Work on separate issues without them causing conflicts
  • Allow us to do some exploration and try out "what ifs"

If you look on the main page of this repository, you should see that you are currently viewing the 'main' branch of the repository. The main page is where we usually put "finished work".

image

You are now going to create your own branch. Click on the button highlighted in the previous image and click 'view all branches' which should lead you to a new page. On this new page, click 'New Branch'. In the 'New branch name' field, enter something like your name (it doesn't matter what you call it as long as you remember).

image

Under Source, make sure you select the 'Homework' branch, then select 'Create new branch'.

image

Congratulations! You've just created your own branch in a Git project! In the next project we will load the branch into a codespace and actually do some coding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants