Learning Git and Github the Easy Way
So you’ve been hearing about Git and Github and wondering what they actually are? Don’t worry, it is not as complicated as it sounds. Let us walk through everything step by step, from installing Git to pushing your first project on Github and even making open source contributions.
What Git Really Is
At its core, Git is a system that keeps track of the history of your files. Think of it like a time machine for code. Every change you make is saved so you can always go back to older versions if something breaks.
But here’s the catch. Git and Github are not the same thing. Git is the tool that tracks your changes, while Github is an online platform where you can store and share those changes with others. Github uses Git but it’s more about collaboration.
Installing Git and Github Setup
Installing Git is pretty straightforward. You download it from the official website, click next a few times, and it’s done. On Windows, Gitbash is usually installed along with it. Once installed, open your terminal or command prompt and type:
git --versionIf you see a version number, it means everything is working fine. If not, just search for the error—Git has a huge community, so solutions are easy to find.
The first thing Git asks for is your name and email. This is because when you make changes, Git keeps track of who did what. You can set them like this:
git config --global user.name "Your Name"
git config --global user.email "your@email.com"Making Your First Git Repository
A repository is just a fancy word for a project folder that Git tracks. You can create one by opening your project folder in the terminal and typing:
git initThis sets up an empty repository. From now on, Git will watch this folder for changes.
If you add a new file, say Sum.java, you can check the status with:
git statusGit will show it as “untracked.” To start tracking it, you need:
git add Sum.javaNow the file is in something called the “staging area.” Think of staging like a waiting room for changes. You put files there first, and then commit them:
git commit -m "Initial commit"A commit is like saving a snapshot of your project at a point in time. You can always go back to it later if needed.
Checking Git History and Moving Around
You can see all your commits with:
git logEach commit gets a unique ID. If you ever want to go back to an old version, you can use:
git checkout <commit-id>And when you’re ready to return to your latest version:
git checkout masterWorking with Git Branches
Branches let you work on new features without messing up your main project. By default, you start with the master branch. You can create a new branch like this:
git branch dev
git checkout devNow you’re in the dev branch and can make changes safely. When your feature is ready, you merge it back into master:
git merge devThis way, multiple people can work on different features without interfering with each other.
Ignoring Files in Git
Sometimes you don’t want Git to track certain files, like secret keys or temporary files. That’s where .gitignore comes in. Just create a file called .gitignore and list the files you don’t want tracked. Simple.
Enter Github
Now comes the fun part—Github. While Git is local, Github is where your code lives online. It lets you share your work, collaborate with others, and even show off your skills to recruiters.
To connect your local repo to Github, you create a new repo on Github, then run these commands:
git remote add origin <repo-link>
git push -u origin masterNow your project is live on Github. From here on, you just use git push whenever you make new commits.
Collaborating with Others on Github
If you want to work with a team, you can add collaborators directly to your repo. They’ll get permission to clone, make changes, and push code.
Another way is through open source contributions. Here’s how that works:
- Find a project you like on Github.
- Click the fork button to make a copy in your account.
- Clone your fork to your computer.
- Make changes and commit them.
- Push the changes back to your fork.
- Open a pull request to the original project.
The project owner reviews your changes and decides whether to merge them. That’s how open source magic happens.
Final Thoughts on Git and Github
Git and Github might feel overwhelming at first but once you practice a few times, it becomes second nature. It’s all about repetition commit, push, pull, branch, merge. Do it enough times and it’ll feel like muscle memory.
So go ahead, make your first repo, push it to Github and maybe even try contributing to open source. Who knows, your first pull request could be the start of something amazing.







