Skip to content

UsamaIsrarDev/learn-github

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Learn GitHub

GitHub Repository (Repo)

  • A repository on GitHub works like a folder where all your code is stored.
  • You can create and publish repositories to share your projects or code.

GitHub Profile Setup

  • Edit your GitHub profile by adding your name, bio, social links, and portfolio link.
  • This makes your profile look more professional and helps others know more about you.

Commit & Changes

  • After editing your code, use “Commit Changes” to save and track your modifications on GitHub.

More Key Concepts

Following GitHub Users & Community

  • You can follow other developers, teachers, or friends on GitHub to stay updated with their latest code and repositories.
  • When you follow someone, you can easily see their latest updates without visiting their profile repeatedly.

Forking a Repository

  • Forking means copying someone else’s repository into your own GitHub account.
  • This allows you to use their code, explore it, and even make your own changes.
  • GitHub automatically shows the source repository where the code came from.

Accessing & Using Code

  • Instead of asking repeatedly for code, you can fork or download repositories directly to your account.
  • This helps you keep track of new updates easily through your GitHub feed.

Profile Connections & Learning

  • Follow people who share valuable projects and clean code — it helps you learn faster.
  • Having active connections in the GitHub community exposes you to good coding practices and real-world examples.

Permissions & Pull Requests

  • You cannot directly change someone else’s repository without permission.
  • To contribute, you must send a pull request, which the owner can review and merge if approved.

Importance of a GitHub Account

  • Every developer should have a GitHub account to showcase their projects, collaborate, and build a professional portfolio.
  • Create your profile, upload code, and start connecting with the global developer community.

Git, GitHub & React.js Complete Developer Notes

Welcome to the ultimate guide for mastering Git, GitHub, and React.js — from beginner to professional developer level.
This file covers everything from Git setup and commands to React project structure and professional developer mindset tips.


Git & GitHub Important Notes

Overview

GitHub is an open-source platform used for hosting and sharing code.

You can push your code to GitHub using:

  • Git Desktop (GUI) — beginner-friendly
  • Git Bash (CLI) — professional and widely used

💡 Version Control helps developers manage and track changes made by multiple people in the same project.


Common Git Platforms

Platform Description
GitHub Most popular for open-source projects
GitLab Used in enterprise environments
Bitbucket Integrated with Jira and Atlassian tools

All platforms use similar Git commands — only the interface and hosting differ.


Ways to Push Code to GitHub

There are two main ways:

  1. Git Desktop → beginner-friendly
  2. Git Bash / Command Line → professional, recommended

Steps to Create & Push a Project on GitHub

  1. Go to GitHub → New Repository
  2. Name it (e.g., ABC-Website)
  3. Choose visibility:
    • Public: Anyone can view
    • Private: Only invited users can access
  4. Click Create Repository
  5. Copy the repository URL
  6. Open your project folder → Right-click → Open Git Bash Here
  7. Run these commands:
# Initialize Git
git init

# Add all files
git add .

# Check status
git status

# Commit files
git commit -m "Initial commit"

# Configure user info (only once)
git config --global user.name "YourName"
git config --global user.email "youremail@example.com"

# Add remote origin (paste repo URL)
git remote add origin https://github.com/YourUsername/ABC-Website.git

# Push code to main branch
git push -u origin main

Important Git Concepts

Command Description
git pull Fetch and merge latest changes
git push Send local commits to remote repo
git add Stage changes for commit
git commit Save changes locally
git status Show current working state
Branch A separate line of development
Merge Combine code from different branches
Conflict Happens when multiple edits clash

Branching & Collaboration

  • Each developer works on a separate branch
  • Before pushing, always pull the latest code
  • Resolve merge conflicts manually if needed
  • After testing, merge into the main branch

Notes

  • Files over 100MB cannot be uploaded directly
  • Use meaningful commit messages, e.g.,
    Added navbar component
    update

Advanced Git & GitHub Notes (Branches, Pull Requests & Deployment)

First-Time Push

If Git suggests:

git push --set-upstream origin main

It means you’re linking your local branch with the remote main branch.

After that, simply use:

git push

Understanding Branches

A branch is a separate workspace within your repo.

Example:

git checkout -b sadiq
git branch

checkout -b → create and switch to a new branch

All new commits now belong to your new branch.


Adding & Committing Changes

git add .
git commit -m "Added header section"
git push

If it’s a new branch’s first push:

git push --set-upstream origin branch-name

Pull Requests (PR)

A Pull Request (PR) = asking to merge your branch code into another branch (usually main).

Steps:

  1. Go to your repo → Compare & Pull Request
  2. Review code changes
  3. Click Merge Pull Request if approved

Handling Conflicts

Conflicts occur when multiple edits affect the same file or line.

Always run before pushing:

git pull origin main

Then fix conflicts → commit → push again.


Deployment with GitHub Pages

You can host static websites on GitHub for free.

Steps:

  1. Ensure project has index.html in the root
  2. Go to Settings → Pages
  3. Choose branch → Save
  4. Wait 30–60 seconds

Your site will appear at:

https://yourusername.github.io/repository-name/

Git Command Summary

Command Description
git init Initialize repo
git add . Stage files
git commit -m "" Save changes
git branch List branches
git checkout -b Create & switch branch
git push Upload to GitHub
git pull Get latest changes
git merge Merge branches
git push -f Force push (use carefully)

Best Practices

  • Always use new branches for new features
  • Write clear commit messages
  • Pull latest code before pushing
  • Review PRs before merging
  • Keep index.html at root for deployment

Professional Developer Mindset

Strengthen Your Foundations

Before applying for jobs:

  • Create a 1-page resume
  • Focus on strong projects, not certificates
  • Keep GitHub clean and public
  • Build a portfolio website

One meaningful project > Ten small static pages


Focus on Real Projects

Create apps that solve problems:

  • Password Generator 🔐
  • File Sharing App 📁
  • Blog App ✍️
  • Quiz App 🎯

Manage Time Wisely

🕒 “One focused hour daily can change your career.”

Be consistent — even 1 hour a day compounds.


React.js

🔹 What is React?

React is an open-source JavaScript library for building dynamic and interactive user interfaces, maintained by Meta (Facebook).


Installation (Using Vite)

npm create vite@latest my-react-app
cd my-react-app
npm install
npm run dev

Vite is preferred over CRA because it’s faster and lightweight.


Benefits of React

✅ Reusable Components
✅ Faster Performance (Virtual DOM)
✅ Modular, Maintainable Code


What Are Components?

A component is a reusable piece of UI logic.

Example:

function Header() {
  return <h1>Welcome to My Website</h1>;
}
export default Header;

Use anywhere:

<Header />

React Folder Structure

my-react-app/
├── public/
│   ├── images/
│   ├── audio/
│   └── videos/
├── src/
│   ├── assets/
│   ├── App.jsx
│   ├── index.css
│   └── main.jsx
├── .gitignore
├── package.json
└── vite.config.js

Important Files

File Purpose
index.html Root of the app
main.jsx Entry point
App.jsx Root component
.gitignore Exclude files like node_modules

Styling in React

  • CSS Modules (Recommended)
  • Tailwind CSS
  • Inline Styles (Avoid)

Example CSS Module:

/* Header.module.css */
.title {
  color: blue;
}

Tailwind CSS Setup

npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

Then add Tailwind directives to your index.css.


Git Integration with React

git init
git add .
git commit -m "Initial React setup"
git remote add origin https://github.com/yourusername/my-react-app.git
git push -u origin main

Future pushes:

git add .
git commit -m "Updated App component"
git push

Cloning & Running a React Project

git clone https://github.com/username/repo.git
cd repo
npm install
npm run dev

Common Commands Summary

Command Description
npm run dev Start React app locally
npm install Install dependencies
git add . Stage changes
git commit -m Save changes
git push Upload to GitHub
npm run build Build for production

Developer Tips

  • Use modular components
  • Avoid inline styles
  • Never push node_modules
  • Learn props & state early
  • Build small apps to strengthen concepts

Final Summary

Steps to Become a Professional Developer:

  1. Build strong foundations
  2. Learn JavaScript → React → Next.js
  3. Push code regularly on GitHub
  4. Create real-world projects
  5. Stay consistent — daily improvement matters

💬 "Code, Commit, Collaborate — and never stop learning."


About

I explore and practice GitHub features, workflows, and CLI commands to improve my understanding of version control and collaborative development.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors