Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions courses/github/clone-a-repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
id: clone-a-repository
title: Clone a Repository
sidebar_label: Clone a Repository
sidebar_position: 4
description: Learn how to clone a repository from GitHub to your local machine using Git. Clone a project, work on it locally, and push your changes back to GitHub.
tags: [github, git, version control, collaboration, beginners]
keywords: [github, git, version control, collaboration, beginners, open source, repository, clone, project]
---

**To work on a project from GitHub, you need to clone the repository to your local machine. This allows you to make changes to the project, work on new features, and contribute to the codebase.**


To clone a repository from GitHub, follow these steps:

1. Go to [GitHub](https://github.com/) and log in to your account. After logging in, you will see your GitHub dashboard.

<BrowserWindow url="https://github.com/chh-user" bodyStyle={{ padding: 0 }}>
![GitHub Login](img-12.png)
</BrowserWindow>

2. Navigate to the repository you want to clone. You can find repositories on your dashboard, in your profile, or by searching for a specific repository.

<BrowserWindow url="https://github.com/chh-user?tab=repositories" bodyStyle={{ padding: 0 }}>
![Repository List](img-13.png)
</BrowserWindow>

3. Click on the repository you want to clone to open its main page. On the main page, you will see the repository details, code, issues, and other information. For example, let's clone the "hello-world" repository.

<BrowserWindow url="https://github.com/chh-user/hello-world" bodyStyle={{ padding: 0 }}>
![Repository Main Page](img-14.png)
</BrowserWindow>

4. Click on the "Code" button to open the code download options. You can clone the repository using HTTPS, SSH, or GitHub CLI. For this tutorial, we will use HTTPS.

<BrowserWindow url="https://github.com/chh-user/hello-world" bodyStyle={{ padding: 0 }}>
![Code Download Options](img-15.png)
</BrowserWindow>

5. Copy the HTTPS URL of the repository. You will use this URL to clone the repository to your local machine.

<BrowserWindow url="https://github.com/chh-user/hello-world" bodyStyle={{ padding: 0 }}>
![HTTPS URL](img-16.png)
</BrowserWindow>

6. Open your terminal or command prompt on your local machine. Navigate to the directory where you want to clone the repository. Use the `cd` command to change directories.

```bash title="Terminal"
cd path/to/directory
```

7. Clone the repository using the `git clone` command followed by the HTTPS URL you copied earlier. This command will download the repository to your local machine.

:::tip Note:
Replace `chh-user` with the **username** of the repository owner and `hello-world` with the name of the repository you want to clone.
:::

```bash title="Terminal"
git clone https://github.com/chh-user/hello-world.git
```

![alt text](img-17.png)


8. After cloning the repository, you can navigate to the project directory using the `cd` command.

```bash title="Terminal"
cd hello-world
```

9. You have successfully cloned the repository to your local machine. You can now work on the project, make changes to the code, and push your changes back to GitHub.

```pwsh
# Make changes to the code
# Add new features
# Fix bugs
# Push changes back to GitHub
```

Congratulations! You have successfully cloned a repository from GitHub to your local machine. You can now start working on the project, collaborate with others, and contribute to the codebase. Happy coding! 🚀
70 changes: 70 additions & 0 deletions courses/github/create-a-branch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
id: create-a-branch
title: Create a Branch
sidebar_label: Create a Branch
sidebar_position: 5
description: Learn how to create a new branch in a Git repository. Create a branch to work on new features, bug fixes, or experiments without affecting the main codebase.
tags: [github, git, version control, collaboration, beginners]
keywords: [github, git, version control, collaboration, beginners, open source, branch, create, new, feature, bug fix]
---

**To work on new features, bug fixes, or experiments in a Git repository, you need to create a new branch. Branches allow you to work on different parts of the codebase without affecting the main branch.**

:::caution Prerequisites
- Make sure you have installed Git on your local machine and configured it with your GitHub account before creating a new branch. If you haven't done this yet, follow the **[official Git installation guide](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)**.
- Always create a new branch for each new feature, bug fix, or experiment to keep your codebase clean and organized.
- Make sure you have downloaded the VS Code editor from the official website before following this tutorial. If you haven't done this yet, you can download it from **[https://code.visualstudio.com/](https://code.visualstudio.com/)**.
- VS Code is a popular code editor that provides built-in Git support, making it easy to work with Git repositories directly from the editor.
:::

To create a new branch in a Git repository, follow these steps:

1. Open VS Code and open the project you want to create a branch in.

2. Open the terminal in vs code.

3. Run the following command to create a new branch. Replace `branch-name` with the name of your new branch.

```bash title="Terminal"
git checkout -b branch-name
```

:::tip Note:
The `-b` flag is used to create a new branch. If you want to switch to an existing branch, you can omit the `-b` flag.
:::

4. Your new branch is now created. You can start working on new features, bug fixes, or experiments in this branch without affecting the main codebase.

5. To switch between branches, use the `git checkout` command followed by the branch name.

```bash title="Terminal"
git checkout main
```

This command will switch to the `main` branch. Replace `main` with the name of the branch you want to switch to.

6. To list all branches in the repository, use the `git branch` command.

```bash title="Terminal"
git branch
```

This command will list all branches in the repository and highlight the current branch with an asterisk (`*`).

7. To delete a branch, use the `git branch -d` command followed by the branch name.

```bash title="Terminal"
git branch -d branch-name
```

This command will delete the specified branch. Be careful when deleting branches, as this action cannot be undone.

8. To push a new branch to GitHub, use the `git push` command followed by the branch name.

```bash title="Terminal"
git push origin branch-name
```

This command will push the new branch to GitHub, allowing you to collaborate with others and share your work.

Congratulations! You have successfully created a new branch in your Git repository. You can now work on new features, bug fixes, or experiments in this branch without affecting the main codebase.
4 changes: 1 addition & 3 deletions courses/github/create-a-github-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ keywords: [github, git, version control, collaboration, beginners, open source,

**To get started with GitHub, you need to create a GitHub account. If you already have a GitHub account, you can skip this step.**

## Create a GitHub account

To get started with GitHub, you need to create a GitHub account. If you already have a GitHub account, you can skip this step.

1. Go to [GitHub](https://github.com/) and click on the "Sign up" button.

<BrowserWindow url="https://github.com" minHeight={300} bodyStyle={{ padding: 0 }}>
<BrowserWindow url="https://github.com" bodyStyle={{ padding: 0 }}>
![GitHub Sign Up](img-1.png)
</BrowserWindow>

Expand Down
Binary file added courses/github/img-12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added courses/github/img-13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added courses/github/img-14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added courses/github/img-15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added courses/github/img-16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added courses/github/img-17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading