Git & GitHub Complete Cheat Sheet 🐙 From git init to Pull Requests — A Handwritten Visual Guide This isn’t just another command list. It’s a handwritten, visual cheat sheet that makes Git & GitHub easy to understand, remember, and apply 🧠✍️ Whether you’re a beginner or a team lead, this guide helps you master version control — without the confusion. --- 🔍 What’s Inside? 🟢 Git Basics (Visual & Simple) ✅ Why version control? – Undo + history for code ✅ Git vs GitHub – Local tool vs cloud platform (with analogy diagrams) ✅ How Git works internally – Snapshots, not differences (explained visually) ✅ Git areas – Working Directory → Staging Area → Local Repo → Remote Repo 🟡 Essential Commands (With Visual Flow) ✅ git init – Start a new repo ✅ git clone – Copy from GitHub ✅ git status – See what’s modified/staged ✅ git add – Stage changes (file or all) ✅ git commit -m – Save a snapshot ✅ git push / git pull – Sync with remote 🔴 Branching & Merging (The Visual Way) ✅ Why branches? – Protect main code, parallel work ✅ git branch – List/create branches ✅ git checkout -b – Create & switch ✅ git merge – Combine branches ✅ Conflicts – Not errors → decision points (with diagrams) 📌 Best Practices & Interview Tips ✅ Commit message mastery – Good vs bad examples ✅ Branch strategy – Feature branches, safe code flow ✅ Pull before push – Sync with team ✅ Interview Q&A – Git workflow, reset vs revert, merge conflicts --- ⚡ Why This Cheat Sheet Stands Out · 🧩 Handwritten style – More memorable than plain text · 🎯 Visual diagrams – Git areas, snapshot model, merge flow · 📚 One‑page quick reference – No fluff, just what you need · 🧠 Beginner + interview prep – Concepts + commands + best practices · 🔁 Git vs GitHub analogy – Understand the difference forever --- 🎯 Perfect For: · 👨💻 New developers learning version control · 🧪 Developers preparing for Git interview questions · 🔁 Open‑source contributors who need a quick reference · 🎓 Students who learn better with visuals · 📌 Anyone tired of Googling “git cheat sheet” every week --- 🔥 Example Topics You’ll Master: # Topic 1 Why version control? 2 Git snapshot model vs delta model 3 Working Directory → Staging → Local → Remote 4 git init, git clone, git status 5 git add, git commit, git push, git pull 6 Branching & merging (with diagrams) 7 Merge conflicts = decision points 8 Good vs bad commit messages 9 git reset vs git revert (interview prep) 10 Best practices: branch for features, pull before push --- 📌 Pro Tips from the Guide: “Clean history = a respectable developer.” “Conflict is not an error — it’s a decision point.” “Git for the machine, GitHub for the cloud.” --- #Git #GitHub #VersionControl #CheatSheet #DevTools #OpenSource #CodingInterview #GitCommands #Branching #Merging #PullRequest #DevProductivity #LearnGit #InterviewPrep #CodeWithAswin #HandwrittenNotes #TechGuide
Git & GitHub Complete Visual Cheat Sheet
More Relevant Posts
-
Git & GitHub Complete Cheat Sheet 🧠 From git init to Pull Requests — A Handwritten Visual Guide This isn’t just another command list. It’s a handwritten, visual cheat sheet that makes Git & GitHub easy to understand, remember, and apply 🧠✍️ Whether you’re a beginner or a team lead, this guide helps you master version control — without the confusion. 🔍 What’s Inside? 🟢 Git Basics (Visual & Simple) ✅ Why version control? – Undo + history for code ✅ Git vs GitHub – Local tool vs cloud platform (with analogy diagrams) ✅ How Git works internally – Snapshots, not differences (explained visually) ✅ Git areas – Working Directory → Staging Area → Local Repo → Remote Repo 🟡 Essential Commands (With Visual Flow) ✅ git init – Start a new repo ✅ git clone – Copy from GitHub ✅ git status – See what’s modified/staged ✅ git add – Stage changes (file or all) ✅ git commit -m – Save a snapshot ✅ git push / git pull – Sync with remote 🔴 Branching & Merging (The Visual Way) ✅ Why branches? – Protect main code, parallel work ✅ git branch – List/create branches ✅ git checkout -b – Create & switch ✅ git merge – Combine branches ✅ Conflicts – Not errors → decision points (with diagrams) 📌 Best Practices & Interview Tips ✅ Commit message mastery – Good vs bad examples ✅ Branch strategy – Feature branches, safe code flow ✅ Pull before push – Sync with team ✅ Interview Q&A – Git workflow, reset vs revert, merge conflicts ⚡ Why This Cheat Sheet Stands Out 🧩 Handwritten style – More memorable than plain text 🎯 Visual diagrams – Git areas, snapshot model, merge flow 📚 One-page quick reference – No fluff, just what you need 🧠 Beginner + interview prep – Concepts + commands + best practices 🔁 Git vs GitHub analogy – Understand the difference forever 🎯 Perfect For: 👨💻 New developers learning version control 🧪 Developers preparing for Git interview questions 🔁 Open-source contributors who need a quick reference 🎓 Students who learn better with visuals 📌 Anyone tired of Googling “git cheat sheet” every week 🔥 Example Topics You’ll Master: Why version control? Git snapshot model vs delta model Working Directory → Staging → Local → Remote git init, git clone, git status git add, git commit, git push, git pull Branching & merging (with diagrams) Merge conflicts = decision points Good vs bad commit messages git reset vs git revert (interview prep) Best practices: branch for features, pull before push 📌 Pro Tips from the Guide: “Clean history = a respectable developer.” “Conflict is not an error — it’s a decision point.” “Git for the machine, GitHub for the cloud.” #Git #GitHub #VersionControl #CheatSheet #DevTools #OpenSource #CodingInterview #GitCommands #Branching #Merging #PullRequest #DevProductivity #LearnGit #InterviewPrep #HandwrittenNotes #TechGuide
To view or add a comment, sign in
-
🚀 Git Workflow Explained Clearly – 4 Stages Sharing practical knowledge on Git Workflow in a simple way. Many people use commands like git add, git commit, and git push, but knowing what happens behind the scenes makes Git easier to learn and use confidently. 💡 Git mainly works in 4 stages, and each stage has file states every developer should know. 🔹 1️⃣ Working Directory / Working Tree Your project folder where files are created, edited, renamed, or deleted. 👉 Common file states: ✅ Untracked Files – New files created by you, but Git has not started tracking them yet. ✅ Tracked Files – Files already known to Git from previous commits. ✅ Modified Files – Tracked files that were changed after the last commit. ✅ Deleted Files – Tracked files removed from the folder. 📌 Command: git status 📌 Note: Changes exist only in your system. Nothing saved in Git history yet. 🔹 2️⃣ Staging Area / Index Place where selected changes are prepared for the next commit. Review area before saving permanently. 👉 Common terms: ✅ Staged Changes – Files added using git add and ready for commit. ✅ Partially Staged Changes – Only selected changes from a file are staged. 📌 Commands: git add filename → Add one file git add . → Add all files git restore --staged filename → Remove from staging 📌 Note: Only staged changes go into next commit. 🔹 3️⃣ Local Repository Git’s local database where commits are stored. 👉 Important terms: ✅ Commit – A saved version of your project changes. ✅ HEAD – Points to the latest commit in your current branch. ✅ Branch – A separate line of development such as main, dev, or feature. ✅ Commit History – Record of all previous commits. 📌 Commands: git commit -m "Added login page" git log 📌 Note: Changes are saved locally, not shared online yet. 🔹 4️⃣ Remote Repository Online repository like GitHub, GitLab, or Bitbucket. Used for backup and collaboration. 👉 Common terms: ✅ origin – Default remote repository name. ✅ Push – Upload local commits to remote repository. ✅ Pull – Download latest changes from remote repository. ✅ Fetch – Check updates from remote without merging. ✅ Clone – Copy remote repository to your local system. 📌 Commands: git push origin main git pull origin main git clone <repo-url> 📌 Note: This is where teams collaborate securely. 💼 Real-Time Example A developer creates a new file called login.html 1️⃣ File starts as Untracked 2️⃣ git add login.html → becomes Staged 3️⃣ git commit -m "Added login page" → saved locally 4️⃣ git push origin main → uploaded to remote repository This is the same workflow used in real projects every day. #Git #GitHub #DevOps #VersionControl #LearningGit #Developers #Automation #CareerGrowth #TechCommunity
To view or add a comment, sign in
-
-
𝗧𝗿𝗮𝗶𝗻𝗶𝗻𝗴 𝘀𝗲𝘀𝘀𝗶𝗼𝗻 𝗼𝗻 𝗚𝗶𝘁 𝗮𝗻𝗱 𝗚𝗶𝘁𝗛𝘂𝗯, 𝗽𝗮𝗿𝘁 𝗼𝗳 𝗮 𝗠𝘂𝗹𝘁𝗶-𝗖𝗹𝗼𝘂𝗱 𝘄𝗶𝘁𝗵 𝗔𝗪𝗦 + 𝗗𝗲𝘃𝗢𝗽𝘀 + 𝗔𝗜. 𝗚𝗶𝘁 𝗮𝗻𝗱 𝗚𝗶𝘁𝗛𝘂𝗯 𝗯𝗮𝘀𝗶𝗰𝘀 - Version control concepts, why Git is used, and how it works with commands 𝗚𝗶𝘁 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 - Commands like git clone, git status, git init, git add, git commit, git push, git pull, git remote, git branch, etc. 𝗙𝗼𝗿𝗸𝗶𝗻𝗴 𝗮𝗻𝗱 𝗖𝗹𝗼𝗻𝗶𝗻𝗴 - How to copy repositories from cloud to cloud (fork) and from cloud to local machine (clone) 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴 𝘀𝘁𝗿𝗮𝘁𝗲𝗴𝘆 - Creating feature branches, working on separate branches instead of directly on main/master branch 𝗣𝘂𝗹𝗹 𝗥𝗲𝗾𝘂𝗲𝘀𝘁𝘀 (𝗣𝗥) - How to raise PR, review process, merge conflicts, and the approval workflow 𝗕𝗲𝘀𝘁 𝗽𝗿𝗮𝗰𝘁𝗶𝗰𝗲𝘀 - Why developers should follow PR process, how managers review and approve code, handling merge conflicts 𝗚𝗶𝘁𝗛𝘂𝗯 𝗿𝗲𝗽𝗼𝘀𝗶𝘁𝗼𝗿𝘆 𝘀𝗲𝘁𝘁𝗶𝗻𝗴𝘀 - Collaborators, visibility (public/private), repository configuration options 𝗔𝗱𝘃𝗮𝗻𝗰𝗲𝗱 𝗚𝗶𝘁 𝗰𝗼𝗻𝗰𝗲𝗽𝘁𝘀 - Git rebase, squash merge, fast-forward merge, git stash, git reset, git revert 𝗚𝗶𝘁𝗛𝘂𝗯 𝗳𝗲𝗮𝘁𝘂𝗿𝗲𝘀 - Issues tracking, Projects tab, Wiki pages, Insights, Security settings 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗮𝗹 𝗱𝗲𝗺𝗼𝗻𝘀𝘁𝗿𝗮𝘁𝗶𝗼𝗻𝘀 - Live demonstrations of creating repositories, branches, commits, and pull requests 𝗩𝗲𝗿𝘀𝗶𝗼𝗻 𝗖𝗼𝗻𝘁𝗿𝗼𝗹 𝗕𝗮𝘀𝗶𝗰𝘀: Reviewed the importance of maintaining code history to track changes, identify who made changes, and revert to previous versions when needed. 𝗚𝗶𝘁 𝘃𝘀 𝗚𝗶𝘁𝗛𝘂𝗯: Git is an open-source version control system from 2005 that works with command-line interface (CLI). GitHub is the cloud platform for hosting repositories. 𝗙𝗼𝗿𝗸 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻: Demonstrated how to copy repositories from one GitHub account to another (cloud-to-cloud). Fork creates your own copy of someone's repository, allowing full customization. Example used: VLC player repository. 𝗖𝗹𝗼𝗻𝗲 𝗢𝗽𝗲𝗿𝗮𝘁𝗶𝗼𝗻: Explained git clone command to download repository code to local machine. This is for cloud-to-local copying. Students practiced cloning repositories to their local folders. 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴 𝗦𝘁𝗿𝗮𝘁𝗲𝗴𝘆: Main/Master branch contains stable production code Feature branches are created for new development work Developers work on separate branches to avoid conflicts Main branch is for 2+ year old projects, Master for newer projects 𝗣𝘂𝗹𝗹 𝗥𝗲𝗾𝘂𝗲𝘀𝘁 (𝗣𝗥) 𝗪𝗼𝗿𝗸𝗳𝗹𝗼𝘄: Developer creates feature branch Makes code changes and commits Raises PR to merge into main branch Manager/reviewer reviews code Discusses any issues or conflicts Approves and merges if acceptable Multiple reviewers (up to 15) can be assigned #DevOps #MultiCloudDevOpsAI #Lakshya #AWS #CloudDevOpsHub #VikasRatnavat
To view or add a comment, sign in
-
-
🚀 Top 20 Git Commands Every Developer Must Know In Tech, Change = Deploy In today’s IT world, development doesn’t end with writing code. I used to struggle with Git… Random errors, messy commits, and confusion everywhere 😅 👉 If you change something today… 👉 You must deploy it today. That’s the reality of modern software development. 💡 Why Deployment is Critical? ✔️ Users expect real-time updates ✔️ Bugs need instant fixes ✔️ Features must reach users quickly ✔️ Businesses move at high speed ⚙️ Modern Development Mindset Gone are the days of: ❌ Build → Wait → Deploy later Now it’s: ✅ Build → Test → Deploy → Repeat That’s why Git and GitHub is helps in Deployment part : But once you understood these 20 essential commands, everything changed. If you’re a developer, this is your Git cheat sheet 👇 🧠 Git Basics (Start here) 🔹 git init – Initialize a new repository 🔹 git config – Set username & email 🔹 git clone – Copy a remote repo 🔹 git remote – Manage remote connections ⚙️ Daily Workflow Commands 🔹 git status – Check current changes 🔹 git add – Stage changes 🔹 git commit – Save changes locally 🔹 git push – Upload to remote repo 🔄 Syncing with Remote 🔹 git pull – Fetch + merge changes 🔹 git fetch – Download without merging 🌿 Branching & Collaboration 🔹 git branch – Create/view branches 🔹 git checkout – Switch branches 🔀 Advanced Operations 🔹 git merge – Combine branches 🔹 git rebase – Cleaner commit history 🔹 git log – View commit history 🔹 git diff – Compare changes 🧰 Undo & Recovery Tools 🔹 git stash – Save changes temporarily 🔹 git reset – Undo commits 🔹 git revert – Safe undo with new commit 🔹 git cherry-pick – Apply specific commits 🔥 Why Git is Important? ✔️ Tracks every change in your code ✔️ Makes collaboration easy in teams ✔️ Helps you recover from mistakes ✔️ Industry standard for version control 🛠️ How to Master Git? ✅ Practice daily with real projects ✅ Break things → then fix using Git 😄 ✅ Learn branching & merging deeply ✅ Contribute to open source 🔥 What This Means for Developers 👉 Learn CI/CD pipelines 👉 Understand Git workflows 👉 Write deployable & clean code 👉 Think beyond coding → think production 🎯 Big Lesson: Code is not done when it runs on your machine… It’s done when it runs in production 🚀 🎯 Pro Tip: 👉 Don’t memorize commands 👉 Understand when & why to use them 💡 “Git is not just a tool, it’s a superpower for developers.” 💬 Are you focusing only on coding, or also on deployment #Git #GitHub #VersionControl #Developers #SoftwareEngineering #Coding #TechSkills #OpenSource #LearningInPublic
To view or add a comment, sign in
-
-
🚀 How Git Actually Works? When I first started using Git, I used commands like "git add", "git commit", and "git push"… but I didn’t really understand what was happening behind the scenes. Here’s a simple breakdown that made everything click for me 👇 🔍 1. Git is a Snapshot Tracker (Not File Storage) Git doesn’t store changes like “line-by-line edits” (like we often think). Instead, it stores snapshots of your project at different points in time. 👉 Example: - You create "index.html" - You commit it → Git stores a snapshot - You edit it again → Git stores a new snapshot Think of it like a timeline of your project 📸 📦 2. The 3 Main Areas in Git Git works with 3 key areas: 1. Working Directory → where you write code 2. Staging Area (Index) → where you prepare changes 3. Repository (.git folder) → where commits are stored 👉 Example workflow: # Step 1: Modify a file edit app.py # Step 2: Add to staging git add app.py # Step 3: Save snapshot git commit -m "Added login logic" ✔️ Now Git stores a snapshot of your project with that message. 🌳 3. Commits Form a Tree (Not Just a List) Each commit has: - A unique ID (hash) - A reference to the previous commit 👉 Example: A → B → C If you create a new branch: A → B → C (main) \ D → E (feature) This is why Git is so powerful for parallel development 💡 🌿 4. Branching = Lightweight Copy Branches are just pointers to commits, not full copies of your project. 👉 Example: git branch feature-login git checkout feature-login Now you're working on a separate line of development without affecting "main". 🔄 5. Merging Changes When your feature is ready: git checkout main git merge feature-login Git combines histories of both branches. ✔️ If changes don’t conflict → automatic merge ❗ If conflicts → you resolve manually ☁️ 6. Git vs GitHub (Important!) - Git → version control system (runs locally) - GitHub → cloud platform to store and share repos 👉 Example: git push origin main This uploads your local commits to GitHub. 🧠 Final Thought Git is not just a tool — it’s a time machine for your code ⏳ Once you understand: - snapshots - staging - commits - branches Everything becomes much easier and more predictable. #Git #VersionControl #Programming #Developers #LearningJourney
To view or add a comment, sign in
-
-
🐙 Git & GitHub: The Superpower Every Developer Needs If you write code, you need version control. Period. And Git is how over 70% of developers collaborate, track changes, and avoid "final_FINAL_v3" disasters. Here’s a quick Git cheat sheet based on what actually matters day-to-day: 🔧 First-time setup git config --global user.name "Your Name" git config --global user.email "your@email.com" 📁 Start tracking a project git init ✅ Stage & commit changes git add <file> git commit -m "Meaningful message" # Skip staging for small changes: git commit -a -m "Message" 🌿 Branching (your best friend) git branch <branch-name> # create git checkout <branch-name> # switch git checkout -b <branch> # create + switch git merge <branch> # merge into current git branch -d <branch> # delete ☁️ Connect to GitHub git remote add origin <repo-URL> git push --set-upstream origin main # After first time: git push origin ⬇️ Pull updates from GitHub git pull origin 📜 See what happened git status git log --oneline ⏪ Undo mistakes (safely) # Revert = new commit that undoes old one (safe for shared branches) git revert HEAD # Reset = move branch pointer back (careful!) git reset <commit-hash> # Amend = fix last commit message or add forgotten files git commit --amend -m "Better message" 📦 Clone someone’s repo git clone <URL> <optional-folder-name> 💡 Pro tips: • git branch -a → see all local + remote branches • git push origin <branch-name> → push a new branch to GitHub • git pull = git fetch + git merge Git is not GitHub — GitHub is just the most popular place to host Git repos (owned by Microsoft since 2018). ❓ What’s the one Git command you couldn’t live without? For me — git log --oneline --graph (visualizes branches beautifully). 🎯 Follow Virat Radadiya 🟢 for more..... #Git #GitHub #VersionControl #DevTools #Programming #SoftwareEngineering
To view or add a comment, sign in
-
To simplify learning, I created a Git Commands Cheat Sheet covering all the essentials: 💡 Key Areas Covered: ✔ Setup & Configuration ✔ Adding & Committing Changes ✔ Branching & Merging ✔ Working with Remote Repositories (GitHub) ✔ Undoing Mistakes (reset, revert) ✔ Stashing Changes ✔ Using Tags for Versioning 🎯 Why this matters: – Helps students quickly understand Git fundamentals – Improves team collaboration in real-world projects – Essential skill for internships and software development roles FULL GIT COMMANDS CHEAT SHEET • 1. Setup Git (First Time Only) git config --global user.name "Your Name" → Set your name git config --global user.email "you@email.com" → Set your email git config --list → Show Git settings 2. Start a Repository git init → Create new Git repo git clone <repo-url> → Download project from GitHub 3. Check Status & Files git status → Check file status git Is-files → List tracked files 4. Add & Commit Changes git add file.txt → Add one file git add. → Add all files git commit -m "message" → Save changes git commit -am "message" → Add + commit tracked files 5. View History git log → Show commit history git log --oneline → Short history git show <commit-id› → Show commit details 6. Compare Changes git diff → Show file changes git diff --staged → Compare staged files 7. Branching git branch → Show branches git branch name → Create branch git checkout name → Switch branch git checkout -b name → Create + switch branch git branch -d name → Delete branch 8. Merge Branches git merge branch-name → Merge branch into current branch git rebase branch-name → Reapply commits on another branch 9. Remote (GitHub) git remote add origin URL → Connect GitHub repo git remote -v → Show remote URL git push origin branch → Upload code git push -u origin main → First push git pull origin branch → Download updates git fetch → Get updates without merging 10. Undo & Fix Mistakes git reset HEAD file → Unstage file git reset --soft HEAD~1 → Undo commit (keep changes) git reset --hard HEAD~1 → Delete commit & changes git revert commit-id → Undo commit safely 11. Temporary Save git stash → Save changes temporarily git stash list → View stash list git stash apply → Restore stash 12. Tags (Versions) git tag v1.0 → Create version tag git tag → List tags git push origin v1.0 → Push tag #Git #GitHub #SoftwareEngineering #ComputerScience #Internship #WebDevelopment #Programming #Developers #TechSkills #Learning
To view or add a comment, sign in
-
-
Last week we faced a small issue in our project, but it clearly showed the real importance of Git. We were working on a Maven project. One change was pushed directly to the main branch without proper testing. After deployment, the application started failing. Later we found that a small configuration change caused the issue. What actually went wrong? - No proper branching strategy - Direct push to main branch - No proper code review Use Case of Git If we had followed a proper flow: - Create a feature branch - Test the changes - Then merge into main This issue could have been avoided. What is Git? Git is a Version Control System (VCS) It helps to: - Track changes in code - Maintain history - Roll back when something breaks Types of Version Control - Centralized (CVCS) → Single server dependency - Distributed (DVCS - Git) → Everyone has full copy of repo Git Repository A repository is where your project lives. Types: - Local Repository (your system) - Remote Repository (GitHub) Git Lifecycle (Simple Flow) Working Directory → Staging Area → Repository File states: - Untracked → Not tracked by Git - Staged → Ready to commit - Committed → Saved in repo Unstage example: git restore --staged file Basic Git Commands git init git clone <url> git status git add . git commit -m "message" git log git fetch vs git pull - git fetch → Downloads changes, does not merge - git pull → Fetch + Merge Best practice: Use fetch first, then review changes Branching Strategy (Very Important) Never work directly on main branch. git checkout -b feature-login Common flow: - main (production) - develop - feature branches Merge vs Rebase - Merge → Keeps history, safer - Rebase → Cleaner, linear history git merge feature git rebase main Git Branches & Merging - Create branches for features - Merge after testing - Avoid conflicts by regular updates. Useful Commands (Real Work) git fetch git pull git rebase git cherry-pick <commit> git stash Git Clone Used to copy remote repository to local system: git clone <repo-url> Git Environment Setup - Install Git - Use Git Bash - Configure: git config --global user.name "Your Name" git config --global user.email "your@email.com" Working with GitHub - Create repository on GitHub - Connect local repo - Push code Maven Project to GitHub (Step-by-Step) git init git add . git commit -m "Initial commit" git branch -M main git remote add origin <repo-url> git push -u origin main Final Learning That day, one small mistake caused a big issue. If we had: - Used proper branching - Avoided direct push - Followed review process We could have avoided the failure. Git is not just commands, it is a discipline and process. What do you prefer in your projects? Merge or Rebase? #Git #DevOps #VersionControl #GitHub #Maven #Learning #devsecops #terraform
To view or add a comment, sign in
-
-
How to Push Your Code to GitHub 🤗 #2 Methods Every Beginner Should Know! Whether you're a beginner or brushing up your workflow, here's a clean step-by-step guide to get your project on GitHub. ━━━━━━━━━━━━━━━━━━━━━━ 🔷 METHOD 1: Local First → Push to GitHub ━━━━━━━━━━━━━━━━━━━━━━ ✅ Step 1 — Install Required Tools Make sure you have: • Visual Studio Code • Git installed → verify with: git --version • A GitHub account ✅ Step 2 — Create a New Project Folder Option A (VS Code): File → Open Folder → Create new folder Option B (CMD): mkdir my-project cd my-project code . ✅ Step 3 — Initialize Git git init 👉 Creates a hidden .git folder — Git starts tracking your project! ✅ Step 4 — Create Your Project Files Add your files e.g. main.py, requirements.txt, etc. ✅ Step 5 — Stage Your Files git add . 👉 Tells Git to track all files ✅ Step 6 — Commit Your Code git commit -m "Initial commit" 👉 Saves a snapshot of your project ✅ Step 7 — Create a Repo on GitHub • Go to GitHub → Click New Repository • Name it (same as your folder — recommended) • Click Create Repository ✅ Step 8 — Link Local Project to GitHub git remote add origin https://lnkd.in/dmTgth4z ✅ Step 9 — Push to GitHub 🎉 git branch -M main git push -u origin main ━━━━━━━━━━━━━━━━━━━━━━ 🔷 METHOD 2: GitHub First → Clone Locally ━━━━━━━━━━━━━━━━━━━━━━ Prefer to start on GitHub? This is the cleaner approach for many developers! ✅ Step 1 — Create a Repository on GitHub • Go to GitHub → Click New Repository • Give it a name (e.g., my-project) • ✅ Check "Add a README file" (optional but recommended) • Choose Public or Private • Click Create Repository ✅ Step 2 — Copy the Repository URL • Click the green Code button • Copy the HTTPS URL: example:https://lnkd.in/dmTgth4z ✅ Step 3 — Clone the Repo Locally Open your terminal / CMD and run: git clone "past url" example: git clone https://lnkd.in/dmTgth4z 👉 This downloads the repo and creates a folder automatically! ✅ Step 4 — Open the Project in VS Code cd my-project code . ✅ Step 5 — Add Your Project Files Create your files e.g. main.py, requirements.txt, etc. ✅ Step 6 — Stage & Commit git add . git commit -m "Initial commit" ✅ Step 7 — Push Back to GitHub 🎉 git push origin main 👉 Since you cloned it, the remote is already linked — no need for git remote add! Credit: Krish Naik, Sunny Savita ━━━━━━━━━━━━━━━━━━━━━━ 💡 Which method should you use? 👉 Method 1 — when you already have a local project 👉 Method 2 — when you're starting fresh (cleaner & faster!) Save this post for your next project! 🔖 Found this helpful? ♻️ Repost to help fellow developers! #AIEngineering #PythonBeginner #Coding #TechMadeEasy #LearnToCode #PythonTips #Git #GitHub #VersionControl #Programming #Developer #VSCode #Python #OpenSource #CodingTips #SoftwareEngineering
To view or add a comment, sign in
-
-
Git worktree > Git stash (and it’s not even close) Ever had to pause a feature midway… just to fix something urgent? Your brain probably goes: • git stash • checkout main • create branch • fix → commit • come back → stash pop Works… but it’s fragile. You risk: • Merge conflicts during stash pop • Losing untracked changes • Breaking your mental context • Accidentally committing half-baked work I’ve been there more times than I’d like to admit. Then I started using git worktree — and it completely changed how I handle parallel work. What git worktree actually does Git lets you check out the same repository into multiple directories simultaneously. Not branches switching inside one folder. Multiple folders. Multiple working states. Same repo. git worktree add ../hotfix-branch main This creates a new directory: → Clean checkout → Separate working tree → Independent changes Your original feature branch? Untouched. Exactly as you left it. How this changes your workflow Instead of context switching: • Feature A → stays in /project • Urgent fix → /hotfix-branch • Experiment → /experiment-xyz Each task lives in its own isolated workspace No stashing. No juggling. Under the hood (what’s actually happening) Git internally separates: • Working Tree → your files • Index (staging area) • HEAD (current branch reference) git worktree creates: → New working tree → New HEAD pointer → Shared .git object database So: • Commits are shared • History is shared • But working directories are isolated This is why it’s lightweight — no repo duplication. Why it’s insanely useful • Work on multiple features in parallel • Keep long-running branches untouched • Debug production issues without disturbing local state • Run multiple dev servers for different branches And the big one: 👉 Perfect for AI-assisted workflows If you’re using agents/tools: • Worktree 1 → Feature implementation • Worktree 2 → Refactor • Worktree 3 → Bug fix All running in parallel. No branch pollution. No conflicts from half-done work. Cleanup is simple git worktree remove ../hotfix-branch Gone. Clean. The tradeoff (the “secret sauce”) Worktrees shift complexity from Git → filesystem. You now manage: • Multiple folders • Awareness of where you’re working • Disk structure discipline But in return, you get: 👉 Zero context switching overhead The real takeaway Most developers use Git like a linear tool. But Git is actually built for parallelism. git worktree unlocks that. Question If you’re still using git stash as your default escape hatch… Are you solving the problem—or just working around it? #git #softwareengineering #webdevelopment #developerworkflow #productivity
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Thanks for sharing