Git & Github - First Project
What is Git & GitHub?
Git is a version control system.. it lets you track changes in your code over time.
GitHub is an online platform where you can store Git repositories, collaborate, and share your projects.Think of it as:
“Git saves your project’s history, GitHub makes it easy to share that history with others.”
A typical Git workflow looks like..
- Initialize a Git repository in your project (
git init). - Add files you want Git to track (
git add). - Commit changes with a message (
git commit). - Push your commits to GitHub (
git push).
This ensures your code history is saved locally and synced to GitHub.
Why it’s useful
With Git & GitHub you can:
- Keep a history of changes (never lose work).
- Collaborate with teammates (branches, pull requests).
- Roll back to an earlier version if something breaks.
- Work safely on new features without touching stable code.
Step by Step - Guide
Prerequisites
- Install Git here (
git --version<-- typing this in the Terminal will show it as installed)- If this doesn't work, make sure you restart the computer!
- A GitHub account
- A project folder ready
- Github Tokens setup
- Basic Terminal knowledge
First: Create a Repository on GitHub
Before we publish anything, we need a repository (repo) on GitHub.. this will be the “home” for your project.
Create Repository
- Go to GitHub
- In the top-right corner, click the +, Create New and choose New repository
- Name your repo (e.g.
my-first-repo) - Choose visibility:
- Public (anyone can see it)
- Private (only you and collaborators)
- Important: Leave “Add a README” unchecked (we want an empty repo to push to)
- Click Create repository
Preparing a Local Project
Now let’s make something simple that we’ll upload to GitHub.
Create Project Folder
Create an empty folder for the project and add a file to track.
Mac / Linux (Terminal):
mkdir my-first-repo
cd my-first-repo
echo "This is my backup." > my-backup.txt
ls
Windows (PowerShell):
mkdir my-first-repo
cd my-first-repo
echo "This is my backup." > my-backup.txt
dir
You should now see a file called my-backup.txt in the folder.
Publishing Our Local Project to GitHub
Navigate to your project within the terminal
Always make sure you’re in your project’s root directory before running Git commands.
If you’re in the wrong place, you might accidentally publish sensitive files.
Check your current location with:
pwd
If you accidentally initialized a Git repository and want to remove it, see the bottom section for more information.
Initialize a Git Repository
Inside your project folder:
git init
This creates a hidden .git folder where Git tracks your project’s history.
Verify
type ls -a to verify the existence of the .git folder
Removing Unwanted Initialized Git Repositories
If you accidentally initialized a Git repository and want to remove it,
delete the hidden .git folder:
rm -rf .git
This completely removes Git tracking from the project.
This will remove all local commits therefore it is recommended to perform a project backup!
Now what?
YOU DID IT!
Practice creating a repo, adding files, committing, and pushing to GitHub.
Next step: learn branches and pull requests for teamwork!
Git & GitHub - Documentation
Finished
Back to Overview: Developer Fundamentals




