๐Ÿง‘๐Ÿพโ€๐Ÿ’ป prep

๐Ÿ“š GitHub.dev

Learning Objectives

If you do not have a computer of your own yet (first, let us know!), here’s how to complete your work directly on GitHub without a local environment.

Each repo on GitHub has a .dev environment so you can edit the code in your browser using an online VSCode.

You can go to this environment directly by replacing github.com with github.dev in the URL. For example, to open the Module-Onboarding repo, you can go to

https://github.dev/CodeYourFuture/Module-Onboarding

๐Ÿ’กTip

If you do have a computer, you should set up VSCode and a local environment. This is a workaround for people who don’t yet have the luxury of a personal computer. This also includes borrowing a laptop from MigraCode (you are allowed (indeed expected) to install VS Code and all necessary softwares on MigraCode laptops.)

๐Ÿงฐ Install VSCode

Learning Objectives

We use VS Code to write all of our code in the course. It is known as an Integrated Development Environment (IDE) and really helps you write great code.

๐Ÿ”— Download and install VSCode now

๐Ÿ’กTip

If you are working on a library computer, use the online version of VSCode called Github.dev.

The interface is mostly the same, but you cannot install extensions or use the terminal. You can complete all the tasks in the onboarding module without these features.

๐Ÿ’กTip

But if you have a computer from MigraCode or a computer of your own please download VS code and edit your code locally there (github.dev is only an emergency option).

“Github.dev can be accessed by pressing dot on any GitHub repo”
Press the dot while on any GitHub repo to open Github.dev.

๐Ÿ“‹ Check Git installation

Learning Objectives

Git

You will use Git continually as a developer. We will cover Git in more depth later in the course. Right now, we will just check that you have it installed.

Open up a terminal and run the command git --version to double check you have Git installed. If it is installed successfully, you should get a version number (which may not be exactly the same as this example, but should look similar):

git version 2.40.0

Otherwise, you will need to install it or ask for support on your Slack channel.

๐Ÿ’กTip

If you are working on a library computer, you do not have a terminal, but your github.dev account already has Git installed. (It’s called “Source Control”.) So you can skip this step.

๐Ÿ“‚ Create a work folder

Learning Objectives

๐Ÿ“ขImportant

Make a folder called MCB (stands for MigraCode Barcelona) in your home directory. Store all your work for the course in this folder.

You’ll need to create a MCB folder to store your projects on the course. You can do this any way you like, but here we are using the terminal.

How to create a folder using the terminal

  1. Open a terminal on your computer.

For each of the steps below, you’ll need to use the command line in your terminal.

Use this cli documentation to remember terminal commands.

  1. In your terminal, print your current working directory.

  2. List the files and folders in your current working directory.

You’ll need a place to store your work for the course.

  1. Make a new directory called MCB in your home directory.

  2. Change directory into the MCB directory.

  3. Double check you’re in the right place by printing your current working directory.

๐Ÿ”— Set up Planner

Welcome to your coursework planner

This is how you will plan and manage your coursework at MCB. You will add all your work as issues to your fork of this repository, and then use a project board to manage your work. This is broadly how all technical projects are managed, so you will need lots of practice. Get started today.

1. How to get set up

Forking the My-Coursework-Planner repo

  1. Fork this repo to your own GitHub
    image
  2. You should see your own GitHub username under Owner
    image
  3. Turn on issues in the Settings of your forked version of the repo
    image

You must fork to your personal Github account. Forks created in the MCB org will be deleted by a bot.

Creating your project board

  1. Go to the example project board
  2. Click the three-dot menu, and then select Make a copy
    image
  3. Make sure your own GitHub username is under Owner
    image
  4. Make your project board public so your mentors can see your progress - open the project board settings
    image
  5. Scroll to the bottom to find the setting to make your board public
    image

Linking the My-Coursework-Planner repo to your project board

  1. Go back to your forked version of the My-Coursework-Planner repo
  2. Under Projects, click Link a project and select your project board
    image
  3. That’s it! You’re ready to start adding issues to your board!

2. In every module, you will add your work as issues

Each sprint in each module has a Backlog page which lists the work you’re expected to do for that module. Every item in the list is actually a GitHub issue.

There is a “Clone” button next to each issue. When you’re starting a sprint, clone each of its issues into your coursework planner.

Copy issues for each week or at most for each module. The coursework content is updated frequently, you will not have the most up to date tasks on your board if you copy all modules at once.

If the Clone button isn't working, expand this for instructions of how to manually clone the issues

Each module has a module repo. The coursework for each module is added as issues to that repository. All the module repos are can be found in the repo of its module.

  1. Go to the module repo. Search for the name of the repo in this link
  2. Enter the repo you need (“Onboarding”, “Structuring and Testing Data”..)
  3. Click on the Issues tab
  4. Copy each issue from the module repo to your own coursework repo.

We have also used the Kamino Clone Button Chrome extension to make this easier, so you could try that.

3. Manage and adapt your project board as you learn

There are example project boards attached to each module, showing you ways you can use boards to manage your time, prioritise, scope, and track your work. You should use the same project board all the way through the course, and add to it as you go. Learn as you go, and adapt your board as you learn.

You can, and should, also add your own tickets to the board. Just remember it’s a public board, so don’t add anything you don’t want to share with your mentors.

You can watch this video about how to create your coursework-planner board.

๐Ÿงฐ Development process

Ahmed and Naima are using the following development process for writing their blog:

  • writing the blog in a single file on a single computer
  • saving multiple versions of the file on the same computer
  • taking turns to use the computer during the day

At the moment, the computer has a folder with the blog that looks like this:

different-blog-versions

โœ๏ธExercise

Describe some of the challenges that Ahmed and Naima face when trying to write a blog together in this way.

Look in Slack. Has someone made a post describing Ahmed and Naimaโ€™s challenge?

  • Yes! Then share your thoughts as a reply to this post making a conversation ๐Ÿงตย thread.
  • No! Then be the first to publish a message for this post and add your thoughts in the thread.

โŒ› Version control software

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

To improve their way of working, Ahmed and Naima realise they need the following:

  • a way to both know what the most recent version is
  • a way to know what the old versions were, and in what order (i.e. how they got to the current version, and what content they may have deleted that they may want to get back)

To manage the different versions of the blog project, they decide to use Git.

๐Ÿ“–definition: Git

Git is version control software that allows developers to create and manage different versions of a project.

In Git, we create different versions of a project over time by creating commits.

A commit is a snapshot of our project at a particular point in time. You can also think of a commit as a particular version of a project.

Commits store the following information:

  • what changed in this commit
  • who created the change
  • what time the change happened
  • what the previous commit was

A typical timeline of commits might look like this:

commit-history

๐Ÿ“Commit hashes

Commits also have a hash associated with them. A hash is a long string of characters used to identify a particular commit.

A typical hash will look like this: fec6909d6de23c75e77960986a9b6a7aee7feec7 but you will often see them abbreviated to the first few characters like this: fec6909

๐Ÿ—„๏ธ Sharing history

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

Earlier on, Ahmed and Naima realised they also need the following:

a way to share the history of the project between different users and different computers

To share a project and its history, we can use an online platform called GitHub

GitHub is a platform where teams can store projects along with a history of their different versions.

By storing projects on GitHub, multiple users can gain access to the history of a project.

๐Ÿ“–Definition: Repository

On GitHub we call our project and its history a repository.

โœ๏ธExercise

Explore ๐Ÿ”

In this exercise, you’ll need to explore a GitHub repository.

You’ll need to look around and figure out where to find different files and find out information about them.

โš ๏ธ You won’t be expected to know what the files do at this stage.

Go to the following link: https://github.com/CodeYourFuture/education-blog

It will take you to a GitHub repository called education-blog.

Answer the following questions using the page linked to above:

a) View the README.md file. What do the instructions tell you? b) How many files are there inside the blogs folder? c) How many lines are there in the package.json file? d) Find the file with the blog content you can see on the live site here blog 1

You’ll learn more about these type of files throughout the course.

We can use the Github interface to explore the different commits (versions) of a project too.

โœ๏ธexercise

Explore ๐Ÿ”

Go to the following link: https://github.com/CodeYourFuture/education-blog/commits/main

Try answering the following questions:

Go to the commit that says “add test p element to index page”

Questions

  • How many files were changed in this commit?
  • Who created the change?
  • What time did the change take place?

โœ๏ธexercise

Explore ๐Ÿ”

Go to the following link: https://github.com/CodeYourFuture/education-blog/commits/main and locate commit that says “remove \ and # from start of paragraph”

Questions

  • How many files were changed in this commit?
  • What change was made in this commit?

๐Ÿ” Check out a commit

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

Recall that a commit is a snapshot of our project at some point in time.

Therefore, we should be able to check out a previous version of our project and look at the files and folders there. We can use the Github interface to check out the files and folders at a previous commit.

โœ๏ธexercise

Go back to this page https://github.com/CodeYourFuture/education-blog/commits/main

Locate the the commit with hash 4e78b32 and then look for the icon that that says “Browse the repository at this point in the history”. Explore the code at this point in the history. What differences do you notice?

Do the same but for the commit cd981a0.

๐Ÿ“œ Inspecting previous versions

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

We can view the different commits of a project on Github. This means we can see what the website looked like before, in previous versions.

โœ๏ธexercise

Here are some different versions of the same educational backlog.

Deployed version A educational blog

Deployed version B educational blog

Deployed version C educational blog

Questions

  1. What is the difference between Version A and Version B on the index page (the page you first land on after clicking on the link)
  2. What is the difference between Version C and the main version of the site.
  3. Which commit from the education-blog repo correspond to Version C? Remember to check the git history.
  4. Which commit from the education-blog repo correspond to Version A?

๐Ÿด Forking a repository

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

Often we want to take an existing project and start working on it independently. In other words: we start making our own versions of the project separate from the original project.

We can create a fork๐Ÿงถ๐Ÿงถ forkA fork is a copy of a repository that exists on Github .

When we create a fork on Github, the new forked repository gets a new url:

https://github.com/CodeYourFuture/cyf-demo-repo

flowchart LR subgraph "๐Ÿ“ domain" B end subgraph "๐Ÿ‘ค username" C end subgraph "๐Ÿ“ repo" D end A[๐Ÿ”— https://] --> B[github.com] B--> C[CodeYourFuture] C --> D[cyf-demo-repo]

When the user EagerLearner forks this repo, the path changes from CodeYourFuture to EagerLearner.

flowchart LR subgraph "๐Ÿ“ domain" B end subgraph "๐Ÿ‘ค username" C end subgraph "๐Ÿ“ repo" D end A[๐Ÿ”— https://] --> B[github.com] B--> C[EagerLearner] C --> D[cyf-demo-repo]

โœ๏ธ๐Ÿด Fork a repo

๐Ÿด Fork a repo

  1. Go to https://github.com/CodeYourFuture/education-blog.
  2. Find the Fork button on this page.
  3. Click on the Fork button to create a new fork of the repository and set yourself as the owner of the fork.

๐Ÿ“‹ How can you check you successfully forked the original repository?

Hint: Check the URL of your forked repository

๐Ÿ  Working locally

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

๐Ÿ“Œ Understanding Forking and Cloning

Here is a diagram representing how repositories interact after forking and cloning:

flowchart TD subgraph Remote["Remote (GitHub)"] A["CodeYourFuture/education-blog"] -->|fork| B["EagerLearner/education-blog"] end B -->|clone| C subgraph Local["Local (your computer)"] C["YOUR_CYF_FOLDER/education-blog"] end %% Style definitions classDef container stroke-dasharray:5 5,fill:#f8f9fa,stroke:#495057 classDef rounded rx:10,ry:10,fill:#e9ecef,stroke:#495057 classDef arrow color:#0d6efd,stroke-width:2px %% Apply styles class Remote,Local container class A,B,C rounded linkStyle 0,1 stroke:#0d6efd,stroke-width:2px

Sketch this diagram in your notebook. When you inevitably get confused about where your changes live, this visual will help you understand the flow of changes between repositories.

๐Ÿ“Note

If you’re using a library computer, you can fork the repository to your GitHub account, but you wonโ€™t be able to clone it locally. Come to class to try cloning on your own machine. In the meantime, you can explore the files using GitHub.dev just as you would in Visual Studio Code.


In addition to using GitHub through the browser, we can also use Git on our local machine to perform similar tasks. So, here’s the key question:

How can we get a copy of an existing GitHub repository onto our local computer?

In Git terms, this means creating a local copy๐Ÿงถ๐Ÿงถ local copyA repository on GitHub is a remote repository. A version of it on your own computer is called a local repository. .

The process of copying a remote repository to your local machine is called cloning. The resulting copy is referred to as a clone.


๐ŸŒŸ Goal: Clone a remote repository to your local machine

Youโ€™ll need to clone your fork of the education blog repository. Follow along with this video for step-by-step instructions:

๐ŸŽ—๏ธ Reminder:
  • Make sure youโ€™re cloning your fork of the education-blog repository (not the original).
  • Choose the MCB folder you created in the module prep as the destination for your clone.

๐Ÿ’ก Industry Insight: While forking is useful for learning, companies typically donโ€™t use forking when working on internal projects. Instead, developers clone the original (or central) repository and collaborate by creating branches and pull requests within that shared repo. Forking creates a separate copy under your own account.

๐Ÿ“˜ Viewing files from a git clone

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

Once you’ve got a local copy of a codebase on your local machine you can start to view the files and folders in that codebase. You can use a code editor like VSCode that you will have already used in your application process. This is a refresher to make sure we are all on the same page.

โœ๏ธExercise

Explore VSCode

  1. Figure out how to open the cloned repository on your local machine in VSCode.

  2. Explore the repository in VSCode and use the code editor to look at the various files and folders.

  3. Try opening the Integrated Terminal in your VSCode window

๐Ÿค” If you get stuck on any of these exercises, it’s a good idea to search online. For example, you could Google “opening terminal in vscode”

๐ŸŒณ Branching

Learning Objectives

๐Ÿ“๐Ÿ“Œ Disclaimer

This exercise is hosted on the GitHub repository of our partner NGO, Code Your Future (UK), and not on a MigraCode-owned repository. We are part of a European network where we share resources and support each other as we share the same mission - to provide free, high-quality tech education to our communities.

The exercise works as intended โ€” you are free to fork and clone the repository as usual, if required by the exercise.

However, please do not make any pull requests to the original Code Your Future repository.

We can check the commits on the remote repository as before:

commit-history

On the left page of the page, we see additional information:

main-branch-highlighted

So what is main?

main is a branch.

Commits form a sequence that look like this:

gitGraph commit commit commit

A branch represents a particular history of development in a project - the different versions there have been.

๐Ÿ“–definition: Branch

A branch is a sequence of commits in a project.

There can be different branches with different names, which may have different versions.

For example, if we were testing out some different visual styles, maybe we would have one branch with some extra changes which make the website more blue, and a different branch with some extra changes which make the website more purple. These branches may share some commits in history, but have some extra different commits separately.

gitGraph commit commit branch "try-purple" commit commit checkout main branch "try-blue" commit

The main branch is often treated as a special branch - it’s where we put commits which people working on the project have agreed on. Other branches (e.g. the experimental purple branch) may have extra changes that have not been agreed on. If people working on the project agree the changes from the purple branch are good, we’ll add those changes to the main branch.

When we’re working on something new, we haven’t agreed with other people that our new thing is good yet, so we often don’t add our changes to the main branch straight away. Instead we make our own branch to experiment on.

We can start to create independent branches like this:

gitGraph commit commit branch "week-1-coursework" commit commit commit

In the diagram above, we can continue to commit on the “week-1-coursework” branch without altering the history of the main branch.

โœ๏ธexercise 8.1

Creating a local branch

  1. Open the education-blog repository in VSCode.

  2. Using this clip, create a new branch called update-blog-1 in your local repository ๐Ÿ‘‰ https://youtube.com/clip/UgkxvXsnm_98Rx0NUZq25apQWA6POccRoQzw

๐Ÿ“‹ How can you check that you’ve successfully created a branch?

๐ŸŽ Wrapping up Git

Learning Objectives

๐Ÿ•น๏ธCreating a commit - Figure it out ๐Ÿ”

๐Ÿ“‹ Double check the learning objectives from this sprint. Make a note of those objectives that you’re still struggling with.

Now you’ll need to create a commit.

You can use the “How to commit changes and push them in Visual Studio Code” video to figure out how to create a commit.

We’ll cover this topic often in workshops. Come to a CYF centre to work on this with a mentor.

  1. Try opening your clone of education-blog in VSCode
  2. Make sure you’re on the main branch
  3. Make a new branch for your changes
  4. Try fixing a typo in the README.md file
  5. Try using the video to create a commit of your work.

๐Ÿ“ Backlog

Learning Objectives

In software development, we break down complex projects into smaller, manageable parts, which we work on for a week or two. These periods are called “sprints.”

A sprint backlog is like a to-do list. It lists what the team has decided to work on this sprint. It’s chosen from a larger list, usually called the “product backlog,” which holds the entire project to-do list.

In this course, the backlog is a set of work designed to build understanding beyond the concepts introduced in the course prep. For your course, we have prepared a backlog of mandatory work for each sprint. You will copy these tasks into your own backlog. You can also add any other tickets you want to work on to your backlog, and schedule all of the tasks according to your own goals and capacity. Use your planning board to do this.

You will find the backlog in the Backlog view on every sprint.

Copy the tickets you are working on to your own backlog. Organise your tickets on your board and move them to the right column as you work through them. Here’s a flowchart showing the stages a ticket goes through:

flowchart LR Backlog --> Ready Ready --> in_progress in_progress[In Progress] --> in_review in_review[In Review] --> Done

๐Ÿ•น๏ธBacklog (30 minutes)

  1. Find the sprint backlog
  2. Copy your tickets to your own backlog
  3. Organise your tickets on your board