Skip to content
Open
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
114 changes: 114 additions & 0 deletions org-cyf/content/itp/welcome/backlog/configuring-git-vscode/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
+++
title = "Configuring Git with VSCode"
time = 20
[tasks]
1 = "Install Git on your machine"
2 = "Configure Git with your name and email"
3 = "Set VSCode as your default Git editor"
4 = "Test your Git configuration"
[build]
render = 'never'
list = 'local'
publishResources = false
+++

Git is a version control system that helps developers track changes to their code. Before you can use Git effectively, you need to configure it on your machine and connect it with VSCode, your code editor.

## What is Git?

Git allows you to:
- Track every change you make to your files
- Work collaboratively with other developers
- Save different versions of your project
- Revert to previous versions if something goes wrong

## Step 1: Install Git

### On Windows
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use Windows at CYF, the majority of our trainees will be using Linux unless they have their own Mac. Could you remove the Windows instructions to avoid confusion?

1. Go to [https://git-scm.com/download/win](https://git-scm.com/download/win)
2. Download the installer and run it
3. Follow the installation wizard (most default options are fine)
4. Open a terminal (or Git Bash) and type: `git --version` to verify installation

### On Mac
1. Go to [https://git-scm.com/download/mac](https://git-scm.com/download/mac)
2. Download and install the package
3. Open Terminal and type: `git --version` to verify installation

### On Linux
Open your terminal and run:
```
sudo apt-get install git
```
Then verify: `git --version`

{{<note type="tip" title="What's a Terminal?">}}
A terminal (also called command line or console) is a text-based interface where you type commands to control your computer. Think of it as giving your computer instructions in its native language.
{{</note>}}

## Step 2: Configure Git with Your Name and Email

Git needs to know who you are. Open your terminal and type these commands (replace the values with your own):

```
git config --global user.name "Your Full Name"
git config --global user.email "your.email@example.com"
```

**Why is this important?** Every commit (version save) will be labeled with your name and email, so others can see who made changes.

{{<note type="exercise" title="Configure Your Identity">}}
1. Open your terminal/command prompt
2. Type the commands above with YOUR name and email
3. After each command, press Enter
4. Verify it worked by typing: `git config --list`
5. You should see your name and email in the output
{{</note>}}

## Step 3: Set VSCode as Your Default Git Editor

When you make a commit, Git might open a text editor to let you write a detailed message. Let's tell Git to use VSCode:

```
git config --global core.editor "code --wait"
```

This tells Git: "When I need an editor, use VSCode and wait for me to save and close it before continuing."

## Step 4: Verify Your Configuration

Run this command to see all your Git settings:

```
git config --list
```

You should see:
- `user.name=Your Full Name`
- `user.email=your.email@example.com`
- `core.editor=code --wait`

{{<note type="tip" title="Troubleshooting">}}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a great point to remind trainees that they can ask their colleagues for help, or get help in class on a Saturday. Could you add something like: "If the output doesn't make sense you can post a screenshot in Slack, or get help from a volunteer in class".

If the configuration doesn't appear, or if you see errors, don't worry. The most important settings are `user.name` and `user.email`. You can always reconfigure later.

**Can't open terminal?**
- Windows: Right-click in a folder and select "Open in Terminal" or press `Win + R`, type `cmd`
- Mac: Press `Cmd + Space`, type "Terminal"
- Linux: Right-click desktop and select "Open Terminal Here"
{{</note>}}

## What's Next?

Now that Git knows who you are, you're ready to:
1. Create a local repository
2. Make commits (save versions of your work)
3. Push your code to GitHub

You'll learn these skills in the next modules!

## Further Reading

- [Git Official Documentation](https://git-scm.com/doc)
- [Atlassian Git Tutorial - Getting Started](https://www.atlassian.com/git/tutorials/setting-up-a-repository)
- [GitHub's Git Guides](https://github.github.io/training-kit/)
```
187 changes: 187 additions & 0 deletions org-cyf/content/itp/welcome/backlog/creating-a-commit/index.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great summary of the Git workflow, thanks! It requires some knowledge that our trainees won't have yet, though. So far they have been working exclusively in VSCode and haven't been introduced to the terminal yet (with a couple of exceptions to configure some things). They won't see the terminal for another 2 weeks.

That means we need to either:

  • Add a note on how to open/use the terminal in VSCode before using git init
  • Reframe this to use VSCode's built-in Git tools

I can see the benefit in both approaches, but I do think it's important for trainees to work with Git at the command line at some point in the course. What do you think? Which approach would you take?

Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
+++
title = "Creating a Commit"
time = 25
[tasks]
1 = "Initialize a new Git repository"
2 = "Create and modify files in your repository"
3 = "Stage changes for commit"
4 = "Create your first commit"
5 = "View your commit history"
[build]
render = 'never'
list = 'local'
publishResources = false
+++

A **commit** is a saved version of your project at a particular moment in time. Think of it like saving a document, but with a detailed message explaining what changed and why.

## Understanding the Three States

Git has three states for your files:

1. **Modified** - You changed the file, but haven't saved the version yet
2. **Staged** - You've marked the file as ready to be saved
3. **Committed** - The file is now saved in Git history

```
Working Directory → Staging Area → Git Repository
(Modified) (Staged) (Committed)
```

## Step 1: Create a New Repository

A repository is a folder where Git tracks all your files and their changes.

1. Create a new folder for your project:
```
mkdir my-first-project
cd my-first-project
```

2. Initialize Git in this folder:
```
git init
```

You should see: "Initialized empty Git repository"

{{<note type="exercise" title="Create Your First Repository">}}
1. Open your terminal
2. Navigate to your Documents or Desktop folder
3. Run the commands above
4. You've created your first Git repository! 🎉
{{</note>}}

## Step 2: Create a File and Make Changes

Let's create a simple text file:

1. In VSCode, create a new file called `notes.txt`
2. Add some text:
```
My First Git Project

Today I'm learning Git!
This is my first commit.
```
3. Save the file

## Step 3: Check the Status of Your Repository

Before making a commit, let's see what Git sees:

```
git status
```

You should see output like:
```
On branch main

No commits yet

Untracked files:
(use "git add <file>..." to include in what will be committed)
notes.txt

nothing added to commit but untracked files present
```

Git is saying: "I see a file called `notes.txt`, but you haven't told me to track it yet."

## Step 4: Stage Your Changes

Now we tell Git we want to save this file. This is called **staging**:

```
git add notes.txt
```

You can also stage all files at once:
```
git add .
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you clarify that this stages all changes in the current directory? At the moment trainees will mainly be working in one directory, but as their projects get more complex this might be a source of confusion.

```

Check the status again:
```
git status
```

Now you should see:
```
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: notes.txt
```

Git is saying: "I'm ready to save this file. Are you sure?"

## Step 5: Create Your First Commit

Now we actually save the version:

```
git commit -m "Add initial project notes"
```

The `-m` flag means "message". The message describes what you changed.

{{<note type="tip" title="Good Commit Messages">}}
Write messages that explain **what** you changed and **why**:
- ✅ Good: "Add login button to homepage"
- ✅ Good: "Fix bug where users can't save files"
- ❌ Avoid: "stuff", "changes", "update"

Keep messages short but clear (under 50 characters is ideal).
{{</note>}}

## Step 6: View Your Commit History

See all the commits in your repository:

```
git log
```

You should see your commit with:
- Your name and email
- The date and time
- Your commit message

Press `q` to exit the log.

## Workflow Summary

Here's the complete workflow for making commits:

1. **Modify files** in your editor
2. **Check status**: `git status`
3. **Stage changes**: `git add .`
4. **Create commit**: `git commit -m "Your message"`
5. **View history**: `git log`

{{<note type="exercise" title="Make Another Commit">}}
1. Create a new file called `planning.txt`
2. Add some text to it
3. Save it
4. Run: `git add planning.txt`
5. Run: `git commit -m "Add project planning document"`
6. Run: `git log` to see both commits
{{</note>}}

## Common Commands

| Command | What it does |
|---------|------------|
| `git status` | Shows which files have changed |
| `git add <file>` | Stages a specific file |
| `git add .` | Stages all changed files |
| `git commit -m "message"` | Creates a commit with a message |
| `git log` | Shows all commits in order |
| `git diff` | Shows exactly what changed in files |

## Further Reading

- [Atlassian - Git Commit](https://www.atlassian.com/git/tutorials/saving-changes/git-commit)
- [GitHub Docs - Recording Changes](https://docs.github.com/en/get-started/using-git/about-git)
```
14 changes: 13 additions & 1 deletion org-cyf/content/itp/welcome/backlog/index.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you've updated the wrong index.md - this one is in the backlog directory, it's the one in the prep directory which needs to be changed.

Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,16 @@ menu_level = ["module"]
weight = 2
backlog = "Module-Welcome"
backlog_filter = "📅 Sprint 1"
+++
[[blocks]]
name="Configuring Git with VSCode"
src="module/induction/git-vscode-config"
[[blocks]]
name="Creating a Commit"
src="module/induction/git-creating-commit"
[[blocks]]
name="Remote Repositories"
src="module/induction/git-remote-repositories"
[[blocks]]
name="Pushing & Pulling"
src="module/induction/git-pushing-pulling"
+++
Loading