How to Use GitHub: A Step-by-Step Guide for Version Control & Collaboration
Key Takeaways
- GitHub is built on Git, but adds collaboration tools like pull requests, issues, and Actions for automation.
- You don't need to be a command-line expert—GitHub Desktop and the web interface handle 90% of common tasks.
- A well-maintained GitHub profile can serve as a tech portfolio that hiring managers actually check.
- GitHub Actions can automate testing, deployment, and even sending you a coffee reminder (if that's your thing).
What Is GitHub, Really?
If Git is a time machine for your code, GitHub is the cloud where that time machine lives—plus a social network for developers. As of 2024, GitHub hosts over 200 million repositories and serves 100 million developers. It's not the only game in town (GitLab has about 30 million users, Bitbucket around 10 million), but it's the most popular.
I started using GitHub in 2012 for a class project. Back then, I just clicked "Upload files" and prayed nothing broke. Today, I use it for everything from personal side projects to multi-team deployments. The learning curve is real, but you can get productive in an afternoon.
Step 1: Install Git and Create a GitHub Account
First, download Git from [git-scm.com](https://git-scm.com). On Windows, use the default installer options. On Mac, you can use Homebrew: `brew install git`. Linux users, `sudo apt install git` (or your package manager).
Then sign up at [github.com](https://github.com). Use your real name—it matters for your portfolio later. Skip the paid plans for now; free tier gives you unlimited public and private repos, 2000 Actions minutes per month, and 500 MB of storage.
Configure Git with your name and email (the one you used on GitHub):
```bash
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
```
Step 2: Your First Repository
A repository ("repo") is a folder with version history. Click the green "New" button on GitHub, name it `hello-world`, check "Add a README file", and create.
Now clone it to your computer:
```bash
git clone https://github.com/YOUR-USERNAME/hello-world.git
cd hello-world
```
Open the README.md in any text editor, add `# Hello World`, save, then:
```bash
git add README.md
git commit -m "Add heading"
git push origin main
```
Refresh your GitHub page. You just made your first commit. That's version control in action—every change is now tracked forever.
Step 3: Branching and Pull Requests
This is where collaboration starts. Imagine you and a friend are both editing the same file. Without branches, you'd overwrite each other. With branches, you each work in a copy and merge later.
Create a branch:
```bash
git checkout -b add-content
```
Make some changes to README.md, then commit and push:
```bash
git add .
git commit -m "Add project description"
git push origin add-content
```
Now on GitHub, you'll see a yellow bar suggesting you "Compare & pull request". Click it. Add a title, description, and click "Create pull request".
Your collaborator (or future you) can review the changes, add comments, and click "Merge pull request" when ready. This workflow is the backbone of open source—over 90% of contributions on GitHub use pull requests.
Step 4: Collaborating with Issues and Projects
Issues are GitHub's to-do lists. They track bugs, feature requests, or anything else. Create one by clicking "Issues" > "New issue". Label it "bug", "enhancement", or "help wanted".
For larger projects, use Projects (the new GitHub Projects, not the old beta). It's a Kanban board—drag issues from "To do" to "In progress" to "Done". I use it for my side project that has 47 active issues. Without it, I'd lose track within a week.
Step 5: GitHub Actions for Automation
Actions let you run code when something happens in your repo—like running tests on every push, or deploying to a server. It's like having a robot assistant.
Here's a simple workflow that runs tests on every push. Create `.github/workflows/test.yml`:
```yaml
name: Run tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install
- run: npm test
```
Push this file to your repo, and every subsequent push will trigger the workflow. You get 2000 free minutes per month—enough for about 300 runs of a typical test suite.
Step 6: Building a Portfolio with GitHub
Your GitHub profile is often the first thing recruiters see. Here's what works:
- Pin 5-6 repos to your profile (the "Pinned" section). Choose projects that show different skills: a web app, a CLI tool, a data analysis, etc.
- Write good READMEs: Include what the project does, how to install it, example usage, and a screenshot or GIF. A study by GitHub found that repos with a README get 3x more stars on average.
- Use a profile README: Create a repo named `YOUR-USERNAME/YOUR-USERNAME` and add a README.md. It appears at the top of your profile. Keep it short—your name, what you build, a link to your website or LinkedIn.
- Contribute to open source: Even fixing a typo in documentation counts. It shows you can work with others' code.
Comparison: GitHub vs GitLab vs Bitbucket
| Feature | GitHub | GitLab | Bitbucket |
| --------- | -------- | -------- | ----------- |
| Free private repos | Yes | Yes | Yes (up to 5 users) |
| CI/CD minutes/month | 2000 | 400 | 50 |
| Largest user base | 100M | 30M | 10M |
| Built-in DevOps | Actions | Complete CI/CD | Pipelines |
| Best for | Open source, portfolio | Enterprise, self-hosted | Small teams, Jira users |
I use GitHub for personal projects and GitLab at work because it's self-hosted. For a beginner, stick with GitHub—the community and resources are unmatched.
FAQ
Q: Do I need to learn command-line Git to use GitHub?
No. GitHub Desktop handles commits, branches, and pushes with a visual interface. The web interface also lets you edit files, create pull requests, and merge. But learning basic commands (add, commit, push, pull) will save you time when things break—and they will.
Q: How do I undo a commit I just pushed?
Use `git revert HEAD` to create a new commit that undoes the last one. Never use `git reset --hard` on shared branches—it rewrites history and will confuse everyone else. If you haven't pushed yet, `git reset --soft HEAD~1` works.
Q: Can I use GitHub for non-code projects?
Absolutely. People store writing, design files, even legal documents. Version control works for any text-based project. I've seen authors use it to track book chapters. Just remember Git isn't designed for large binary files (images over 50 MB cause problems).