TeachingSoftware EngineeringGit & GitHub Fundamentals Part 1
Workshop

Git & GitHub Fundamentals Part 1

Worksheet 1 โ€” Git & GitHub Fundamentals | This guide is designed to help you understand the core concepts of version control using Git and how to collaborate using GitHub. You will learn how to track changes, manage branches, and sync your work between your local computer and a remote repository.

๐Ÿ›  Worksheet 1 โ€” Git & GitHub Fundamentals (Local โ†’ Remote)

๐ŸŽฏ Objective

By the end of this workshop, you will be able to:

  • โœ… Initialize a Git repository
  • โœ… Track changes using commit
  • โœ… Connect local work to GitHub
  • โœ… Push and pull changes effectively
  • โœ… Work with branches for safe development
  • โœ… Handle merges and simple conflicts

๐Ÿ“‹ Prerequisites

  • Git installed on your machine
  • GitHub account created
  • VS Code (or your preferred text editor)
  • Basic terminal/command line familiarity

๐Ÿš€ Step-by-Step Guide

Part 0 โ€” Setup

Check Git installation

git --version

Configure identity

git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

Part 1 โ€” Create Local Repository

Create project folder

mkdir latihan-github
cd latihan-github

Initialize Git

git init

Open project in VS Code

code .

Part 2 โ€” First Commit

Create file in VS Code

Create:

README.md

Isi:

# Latihan GitHub
Ini adalah repository latihan Git dan GitHub.

Check status

git status

Add and commit

git add .
git commit -m "Add initial README"

Part 3 โ€” Modify File

Edit README.md di VS Code

Tambahkan:

## Deskripsi
Repository ini digunakan untuk belajar Git.

Check changes

git status
git diff

Commit changes

git add .
git commit -m "Update README description"

Part 4 โ€” Connect to GitHub

Create repository on GitHub

  • Name: latihan-github
  • Visibility: Public
  • Do NOT initialize with README

Connect local to GitHub

git remote add origin https://github.com/USERNAME/latihan-github.git

Rename branch

git branch -M main

Push

git push -u origin main

Part 5 โ€” Add New File

Create file in VS Code

Create:

profile.txt

Isi:

Nama: (isi nama)
Kelas: (isi kelas)
Hobi: (isi hobi)

Commit and push

git add .
git commit -m "Add student profile"
git push

Part 6 โ€” Branching

Create new branch

git checkout -b feature/update-profile

Edit file in VS Code

Tambahkan:

Skill: Git dasar

Commit

git add .
git commit -m "Add skill to profile"

Switch back to main

git checkout main

Merge branch

git merge feature/update-profile
git push

Part 7 โ€” Pull from GitHub

Edit file on GitHub (manual step)

  • Open README.md
  • Click edit
  • Add:
Update from GitHub web

Pull changes locally

git pull origin main

Expected Output

  • Repository exists on GitHub
  • Multiple commits visible
  • Branch created and merged
  • Local repo synced with remote

๐Ÿ† Finished?

If you have completed all the steps above and want a bigger challenge, proceed to the next part where you will learn how to contribute to an open-source project!

Next Step: Git & GitHub Part 2: Open Source Contribution