Skip to content
Mini Courses

Java Mini Lesson 2: Saving Your Code with Git and GitHub

Learn how to use Git to save your work history and GitHub to build an online profile that shows off your skills to future employers.

CodingBowl··1 min read
Photo by Jon Moore on Unsplash

Real developers don't just "save" files—they use Git. Think of Git as a save history for your code that lets you undo mistakes at any time.

The 4 Commands You Need

You can manage your projects using these basic steps in the VS Code terminal:

  • git init: Start tracking a new project folder.

  • git add .: Tell Git which files you want to save.

  • git commit -m "message": Take a snapshot of your code with a short note.

  • git push: Upload your work to GitHub so it is backed up online.

Interactive Java Code (Using Scanner)

To make your programs interactive, you can use the Scanner class to read user input:

`
import java.util.Scanner;

public class AboutMe {
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 + "!");
}
}
`

Build Your Portfolio: GitHub is your developer portfolio. When you push your code there, you are building a collection of work that employers actually look at when hiring.