Welcome to the ultimate GitHub learning guide.
This README is designed so that anyone can learn Git + GitHub from zero to advanced, simply by reading it.
- Clear explanations
- Examples
- Diagrams
- Tables
- Best practices
- Advanced concepts
- Real workflows
Git is a distributed version control system (VCS). It helps developers:
- Track changes in code
- Restore previous versions
- Work on features safely
- Collaborate without overwriting code
Think of Git as a time-machine + teamwork tool for code.
GitHub is an online platform built on top of Git. It provides:
- Cloud hosting for repositories
- Collaboration tools
- Automation (CI/CD)
- Project management
- Documentation hosting
Git = Version control
GitHub = Social network + cloud for Git projects
Download Git from: https://git-scm.com/downloads
git --version
git config --global user.name "Your Name" git config --global user.email "your@email.com"
A repository (repo) is a folder tracked by Git.
Two types:
- Local repository (on your computer)
- Remote repository (on GitHub)
mkdir my-project cd my-project git init
- Log in β Click New Repository
- Enter a name
- Click Create
git remote add origin https://github.com/username/repo.git git push -u origin main
A[Working Directory] β git add β Staging Area β git commit β Local Repo β git push β GitHub Remote Repo
| Command | Purpose |
|---|---|
| git init | Start a new repo |
| git clone | Copy a GitHub repo |
| git add | Stage changes |
| git commit | Save changes |
| git status | Show file states |
| git push | Upload to GitHub |
| git pull | Download from GitHub |
| git log | Show commit history |
git add . git commit -m "Describe what you changed" git push origin main git pull origin main
git checkout -b login-feature
git checkout main
git merge login-feature
git branch -d login-feature
Pull Requests allow:
- Reviewing code
- Discussing changes
- Running automated tests
- Merging feature branches
- Push your branch
- Go to Pull Requests
- Click New Pull Request
- Write title & description
- Add reviewers
- Submit
git clone https://github.com/user/repo.git
Fork = Copy someoneβs repo into your GitHub
git remote add upstream https://github.com/original/repo.git
git fetch upstream git merge upstream/main
- Bugs π
- Feature requests β¨
- Questions β
- Tasks π
| Label | Meaning |
|---|---|
| bug | Something not working |
| enhancement | New feature |
| documentation | Docs needed |
| good-first-issue | Beginner friendly |
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Packages
run: npm install
- name: Run Tests
run: npm test
- Go to Settings β Pages
- Select a branch
- Save
Your website will appear at:
https://username.github.io/repository-name
git reset --soft HEAD~1
git reset --hard HEAD~1
git stash git stash list git stash pop
git rebase main
git cherry-pick <commit-id>
git tag v1.0.0 git push origin v1.0.0
- Commit small & frequently
- Write meaningful commit messages
- Use branches for each feature
- Use PRs & request reviews
- Keep
mainalways stable - Automate tests with GitHub Actions
- Document everything
Happy Coding! β¨π¨βπ»π©βπ»