A Student's Guide to Surviving Git and GitHub

If you are a computer science student or just learning to code, version control is your safety net. It lets you experiment without fear, knowing you can always go back in time.

Here are the essential commands you will use every single day.

1. The Setup: Configure Your Identity

Before doing anything, you need to tell Git who you are so your teammates get the right credit for the code.

git config --global user.name "Your Name"
git config --global user.email "student@university.edu"

2. The Core Loop: Stage, Commit, Push

Every time you write a new feature or fix a bug, you will use these three commands in exactly this order. First, tell Git which updated files you want to include in your next snapshot.

git add index.html

Next, create a permanent, saved snapshot of your staged files. Always write a clear, descriptive message!

git commit

git commit -m "Added the navigation bar"

Finally, push those local snapshots to the remote cloud server (GitHub) so they are backed up safely.

git push

git push origin main

3. Collaboration: Branching Out

When working on group projects for a class, never edit the main code at the same time as your partner. Create a separate branch to work safely in a parallel universe.

git checkout

git checkout -b homework-feature-1

Once your feature is done, make sure you download the code your partners wrote while you were working so you stay perfectly in sync.

git pull

git pull origin main