1 / 9
VS Code Git GitHub Java

From writing code to saving it like a pro

A 25-minute hands-on session — by the end, you'll have your first Java project on GitHub!

IT Applications Development · Lesson 2
2 / 9 Agenda

What we'll cover today

1
VS Code tour
3 min
2
What is Git?
4 min
3
GitHub setup
3 min
4
Java + Git demo
10 min
5
Wrap up
5 min
3 / 9 VS Code

Your coding home — VS Code

VS Code is a free code editor used by developers worldwide

  • Explorer — see all your files on the left panel
  • Terminal — run commands without leaving the editor (Ctrl + `)
  • Extensions — add tools like Java support, themes, Git helpers
  • Source Control tab — built-in Git panel (we'll use this!)
VS Code terminal
$ cd my-project
$ code .
# opens folder in VS Code
Tip
Install the "Extension Pack for Java" from the Extensions panel for Java support
4 / 9 Git

What is Git and why do developers use it?

Think of Git like a save history for your code — like Ctrl+Z but you can go back to any point in time, forever.

Without Git
  • assignment_final.java
  • assignment_final2.java
  • assignment_REAL_final.java
  • 😅 Sound familiar?
With Git
  • One file, clean history
  • Every change is tracked
  • Undo mistakes any time
  • Work with teammates safely
5 / 9 Git

The 3 Git commands you need today

git init
Start tracking a folder with Git — do this once per project
git add .   →   git commit -m "message"
Stage your changes, then save a snapshot with a description
git push
Upload your commits to GitHub so it's backed up online
6 / 9 GitHub

GitHub — your code's online home

# Link your local project to GitHub (do once)
git remote add origin https://github.com/your-username/my-project.git
git branch -M main
git push -u origin main
After this, just use: git push
No need for the long command again — Git remembers where to push
7 / 9 Java + Git demo

Let's write Hello World in Java and commit it

// HelloWorld.java
public class HelloWorld {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}
# In VS Code terminal
git init
git add HelloWorld.java
git commit -m "Add HelloWorld program"
git push
8 / 9 Java + Git demo

Make a change and commit again

Now update the program to greet by name — and see Git track the change

import java.util.Scanner;

public class HelloWorld {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    System.out.print("What is your name? ");
    String name = sc.nextLine();
    System.out.println("Hello, " + name + "!");
  }
}
git add .   git commit -m "Greet user by name"   git push
9 / 9 Wrap up

You did it! What you learned today

  • Navigate VS Code like a pro
  • Understand what Git is and why it matters
  • Push code to GitHub
  • Write and commit a Java program
What to explore next
  • git log — see your commit history
  • git branch — work on features safely
  • GitHub README — describe your project
Keep committing often — every small save counts!
Even for school projects, use Git. It builds good habits and looks great on your GitHub profile.