🚀 Git Commands Cheat Sheet: The "Never-Google-Again" List Stop wasting time searching for Git syntax. Save this guide for your next project! 📌 🔹 Setup & Config git config --global user.name "Name" → Set your username git config --global user.email "email@example.com" → Set your email git config --list → View all configurations 🔹 Initialize & Clone git init → Start a new local repository git clone <url> → Copy a remote repository locally 🔹 Basic Workflow git status → Check current status of changes git add . → Stage all changes for commit git commit -m "message" → Save changes with a description git push → Upload local commits to remote git pull → Download and merge latest remote changes 🔹 Branching & Merging git branch → List all branches git checkout -b <name> → Create and switch to a new branch git checkout <name> → Switch to an existing branch git merge <name> → Merge a branch into the current one 🔹 Remote Repositories git remote -v → View remote URLs git remote add origin <url> → Link local repo to a remote server git push -u origin main → Push and set the default upstream branch 🔹 Undo Changes (The Lifesavers 💀) git restore <file> → Discard changes in a specific file git reset <file> → Unstage a file (keep the code) **git reset --hard** → Delete all local changes (⚠️ Use with caution!) git revert <commit> → Undo a commit by creating a new "inverse" commit 🔹 Stashing (Work in Progress) git stash → Hide uncommitted changes to work on something else git stash pop → Bring stashed changes back git stash list → View all stashes 🔹 Logs & History git log --oneline → View a compact history of commits git diff → Show specific line changes between files 🔹 Advanced Tools ⚡ git rebase <branch> → Reapply commits on top of another base git cherry-pick <commit> → Grab one specific commit from another branch git clean -fd → Delete all untracked files and directories Pro Tip: Commit early, commit often. It's better to have too many save points than none at all. 📩 Let’s Connect / Opportunities 📧 yashtiwari.sfdc@gmail.com 📱 8959459494 🔗 my portfolio : https://lnkd.in/dy72e_VF Found this useful? ✅ Like if you learned something new. 🔁 Repost to help a fellow dev. 💬 Comment "GIT" and I'll send you a PDF version! #Git #Programming #Coding #SoftwareEngineering #TechTips #LearnToCode #WebDev
Git Commands Cheat Sheet: Setup, Workflow, and More
More Relevant Posts
-
If you’re not comfortable with these Git commands, you’re probably slowing down your workflow (and your team’s too). Here’s a practical Git cheat sheet you should be confident using: ─────────────────── → git init — Initialize a new repository → git clone <url> — Copy a repo locally → git status — Check current changes → git add <file> — Stage specific file → git add . — Stage all changes → git commit -m "msg" — Save changes → git commit --amend — Edit last commit → git log — View commit history → git log --oneline — Compact history view → git show <id> — See commit details → git branch — List/create branches → git checkout <branch> — Switch branch → git checkout -b <branch> — Create + switch → git merge <branch> — Merge changes → git branch -d <branch> — Delete branch → git push origin <branch> — Push changes → git pull origin <branch> — Get latest updates → git fetch — Fetch without merging → git reset --soft HEAD~1 — Undo commit (keep changes) → git reset --hard HEAD~1 — Undo commit (remove changes) → git revert <id> — Safely undo a commit → git checkout -- <file> — Discard changes → git stash — Save work temporarily → git stash pop — Restore saved work → git rebase <branch> — Reapply commits → git cherry-pick <id> — Apply specific commit → git tag -a v1.0 — Create version tag → git clean -fd — Remove untracked files → git config --global user.name "Name" → git config --global user.email "email" → git help <command> ─────────────────── This PDF also covers: • Step-by-step Git workflow (init → add → commit → push) • Working with remote repos (clone, push, pull) • Branching & merging • Undoing mistakes (reset, revert) • Advanced usage (stash, rebase, cherry-pick) How to actually use this: 1. Don’t try to memorize everything 2. Focus on daily workflow commands 3. Practice on a small repo 4. Use advanced commands when needed That’s how Git becomes second nature. Save this before your next PR or project work.
To view or add a comment, sign in
-
🤯 If you’re not comfortable with these Git commands, you’re probably slowing down your workflow (and your team’s too). Here’s a practical Git cheat sheet you should be confident using: ─────────────────── → git init — Initialize a new repository → git clone <url> — Copy a repo locally → git status — Check current changes → git add <file> — Stage specific file → git add . — Stage all changes → git commit -m "msg" — Save changes → git commit --amend — Edit last commit → git log — View commit history → git log --oneline — Compact history view → git show <id> — See commit details → git branch — List/create branches → git checkout <branch> — Switch branch → git checkout -b <branch> — Create + switch → git merge <branch> — Merge changes → git branch -d <branch> — Delete branch → git push origin <branch> — Push changes → git pull origin <branch> — Get latest updates → git fetch — Fetch without merging → git reset --soft HEAD~1 — Undo commit (keep changes) → git reset --hard HEAD~1 — Undo commit (remove changes) → git revert <id> — Safely undo a commit → git checkout -- <file> — Discard changes → git stash — Save work temporarily → git stash pop — Restore saved work → git rebase <branch> — Reapply commits → git cherry-pick <id> — Apply specific commit → git tag -a v1.0 — Create version tag → git clean -fd — Remove untracked files → git config --global user.name "Name" → git config --global user.email "email" → git help <command> ─────────────────── This PDF also covers: • Step-by-step Git workflow (init → add → commit → push) • Working with remote repos (clone, push, pull) • Branching & merging • Undoing mistakes (reset, revert) • Advanced usage (stash, rebase, cherry-pick) How to actually use this: 1. Don’t try to memorize everything 2. Focus on daily workflow commands 3. Practice on a small repo 4. Use advanced commands when needed That’s how Git becomes second nature. Save this before your next PR or project work. Follow Sahil Hans for more! 🤝
To view or add a comment, sign in
-
🤯 If you’re not comfortable with these Git commands, you’re probably slowing down your workflow (and your team’s too). Here’s a practical Git cheat sheet you should be confident using: ─────────────────── → git init — Initialize a new repository → git clone <url> — Copy a repo locally → git status — Check current changes → git add <file> — Stage specific file → git add . — Stage all changes → git commit -m "msg" — Save changes → git commit --amend — Edit last commit → git log — View commit history → git log --oneline — Compact history view → git show <id> — See commit details → git branch — List/create branches → git checkout <branch> — Switch branch → git checkout -b <branch> — Create + switch → git merge <branch> — Merge changes → git branch -d <branch> — Delete branch → git push origin <branch> — Push changes → git pull origin <branch> — Get latest updates → git fetch — Fetch without merging → git reset --soft HEAD~1 — Undo commit (keep changes) → git reset --hard HEAD~1 — Undo commit (remove changes) → git revert <id> — Safely undo a commit → git checkout -- <file> — Discard changes → git stash — Save work temporarily → git stash pop — Restore saved work → git rebase <branch> — Reapply commits → git cherry-pick <id> — Apply specific commit → git tag -a v1.0 — Create version tag → git clean -fd — Remove untracked files → git config --global user.name "Name" → git config --global user.email "email" → git help <command> ─────────────────── This PDF also covers: • Step-by-step Git workflow (init → add → commit → push) • Working with remote repos (clone, push, pull) • Branching & merging • Undoing mistakes (reset, revert) • Advanced usage (stash, rebase, cherry-pick) How to actually use this: 1. Don’t try to memorize everything 2. Focus on daily workflow commands 3. Practice on a small repo 4. Use advanced commands when needed That’s how Git becomes second nature. Save this before your next PR or project work. ~~~~~~~#Automation #Testing~~~~~~~~ 🚩 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦 𝐰𝐢𝐭𝐡 𝐉𝐚𝐯𝐚 𝐀𝐮𝐭𝐨𝐦𝐚𝐭𝐢𝐨𝐧 𝐓𝐞𝐬𝐭𝐢𝐧𝐠 (Including AI in Testing,GenAI,Prompt Engineering Training)✅ - Training Starting soon.Register now for further Updates:- https://lnkd.in/dDGcYUgA OR Join WhatsApp group for the latest update:- https://lnkd.in/dSjqT_Ty : Follow Pavan Gaikwad for more helpful content.
To view or add a comment, sign in
-
Master Git with These Essential Commands! 🖥️ 1. Basic Git Commands 📌 git init – Initialize a Git repository. 📌 git clone <repo_url> – Clone a repository to your local machine. 📌 git status – Check the current state of your repository. 📌 git add <file> – Stage changes for commit. 📌 git commit -m "message" – Save changes with a commit message. 📌 git push – Upload local commits to a remote repository. 📌 git pull – Download and merge changes from a remote repository. 2. Branching & Merging 📌 git branch – List branches. 📌 git branch <branch_name> – Create a new branch. 📌 git checkout <branch_name> – Switch to another branch. 📌 git checkout -b <branch_name> – Create and switch to a new branch. 📌 git merge <branch_name> – Merge changes from another branch. 3. Remote Repository Management 📌 git remote -v – View remote repositories. 📌 git remote add <name> <url> – Add a remote repository. 📌 git push origin <branch> – Push changes to a remote branch. 📌 git pull origin <branch> – Pull changes from a remote branch. 4. Viewing & Comparing Changes 📌 git log – View commit history. 📌 git log --oneline – View a simplified commit history. 📌 git diff – Show changes between commits or branches. 📌 git blame <file> – Show who changed each line of a file. 5. Undoing Changes & Resetting 📌 git reset --soft HEAD~1 – Undo last commit but keep changes staged. 📌 git reset --hard HEAD~1 – Undo last commit and remove changes. 📌 git revert <commit_id> – Revert changes without losing history. 📌 git restore <file> – Undo changes in a file. 6. Stashing Changes 📌 git stash – Temporarily save changes without committing. 📌 git stash list – View saved stashes. 📌 git stash pop – Apply the last stash and remove it. 7. Tags & Releases 📌 git tag <tag_name> – Create a tag for a specific commit. 📌 git tag -a <tag_name> -m "message" – Annotated tag with description. 📌 git push origin --tags – Push all tags to the remote repository. 8. Git Hooks & Automation 📌 git pre-commit – Runs scripts before a commit. 📌 git post-commit – Runs scripts after a commit. 📌 git pre-push – Runs checks before pushing to remote. 9. Handling Merge Conflicts 📌 git mergetool – Open a merge conflict resolution tool. 📌 git merge --abort – Cancel a merge. 📌 git diff <branch_1> <branch_2> – Compare differences between branches. 10. Git & DevOps 📌 git fetch --all – Fetch changes from all remotes. 📌 git rebase <branch> – Reapply commits on top of another branch. 📌 git cherry-pick <commit_id> – Apply a specific commit from another branch. 𝐒𝐞𝐥𝐞𝐧𝐢𝐮𝐦-𝐉𝐚𝐯𝐚 & 𝐏𝐥𝐚𝐲𝐰𝐫𝐢𝐠𝐡𝐭-𝐓𝐲𝐩𝐞𝐒𝐜𝐫𝐢𝐩𝐭 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐒𝐭𝐚𝐫𝐭𝐬 𝐨𝐧 𝟐𝟎𝐭𝐡 𝐀𝐩𝐫𝐢𝐥 𝟐𝟎𝟐𝟔! 𝐑𝐞𝐠𝐢𝐬𝐭𝐞𝐫 𝐧𝐨𝐰 𝐟𝐨𝐫 𝐟𝐫𝐞𝐞 𝐝𝐞𝐦𝐨 𝐜𝐥𝐚𝐬𝐬𝐞𝐬:https://lnkd.in/gvbgraRa Follow Sripathi Teja for more helpful content. #GitCommands #OpenSource #GitWorkflow
To view or add a comment, sign in
-
Master Git with These Essential Commands! 🖥️ 1. Basic Git Commands 📌 git init – Initialize a Git repository. 📌 git clone <repo_url> – Clone a repository to your local machine. 📌 git status – Check the current state of your repository. 📌 git add <file> – Stage changes for commit. 📌 git commit -m "message" – Save changes with a commit message. 📌 git push – Upload local commits to a remote repository. 📌 git pull – Download and merge changes from a remote repository. 2. Branching & Merging 📌 git branch – List branches. 📌 git branch <branch_name> – Create a new branch. 📌 git checkout <branch_name> – Switch to another branch. 📌 git checkout -b <branch_name> – Create and switch to a new branch. 📌 git merge <branch_name> – Merge changes from another branch. 3. Remote Repository Management 📌 git remote -v – View remote repositories. 📌 git remote add <name> <url> – Add a remote repository. 📌 git push origin <branch> – Push changes to a remote branch. 📌 git pull origin <branch> – Pull changes from a remote branch. 4. Viewing & Comparing Changes 📌 git log – View commit history. 📌 git log --oneline – View a simplified commit history. 📌 git diff – Show changes between commits or branches. 📌 git blame <file> – Show who changed each line of a file. 5. Undoing Changes & Resetting 📌 git reset --soft HEAD~1 – Undo last commit but keep changes staged. 📌 git reset --hard HEAD~1 – Undo last commit and remove changes. 📌 git revert <commit_id> – Revert changes without losing history. 📌 git restore <file> – Undo changes in a file. 6. Stashing Changes 📌 git stash – Temporarily save changes without committing. 📌 git stash list – View saved stashes. 📌 git stash pop – Apply the last stash and remove it. 7. Tags & Releases 📌 git tag <tag_name> – Create a tag for a specific commit. 📌 git tag -a <tag_name> -m "message" – Annotated tag with description. 📌 git push origin --tags – Push all tags to the remote repository. 8. Git Hooks & Automation 📌 git pre-commit – Runs scripts before a commit. 📌 git post-commit – Runs scripts after a commit. 📌 git pre-push – Runs checks before pushing to remote. 9. Handling Merge Conflicts 📌 git mergetool – Open a merge conflict resolution tool. 📌 git merge --abort – Cancel a merge. 📌 git diff <branch_1> <branch_2> – Compare differences between branches. 10. Git & DevOps 📌 git fetch --all – Fetch changes from all remotes. 📌 git rebase <branch> – Reapply commits on top of another branch. 📌 git cherry-pick <commit_id> – Apply a specific commit from another branch.
To view or add a comment, sign in
-
Master Git with These Essential Commands! 🖥️ 1. Basic Git Commands 📌 git init – Initialize a Git repository. 📌 git clone <repo_url> – Clone a repository to your local machine. 📌 git status – Check the current state of your repository. 📌 git add <file> – Stage changes for commit. 📌 git commit -m "message" – Save changes with a commit message. 📌 git push – Upload local commits to a remote repository. 📌 git pull – Download and merge changes from a remote repository. 2. Branching & Merging 📌 git branch – List branches. 📌 git branch <branch_name> – Create a new branch. 📌 git checkout <branch_name> – Switch to another branch. 📌 git checkout -b <branch_name> – Create and switch to a new branch. 📌 git merge <branch_name> – Merge changes from another branch. 3. Remote Repository Management 📌 git remote -v – View remote repositories. 📌 git remote add <name> <url> – Add a remote repository. 📌 git push origin <branch> – Push changes to a remote branch. 📌 git pull origin <branch> – Pull changes from a remote branch. 4. Viewing & Comparing Changes 📌 git log – View commit history. 📌 git log --oneline – View a simplified commit history. 📌 git diff – Show changes between commits or branches. 📌 git blame <file> – Show who changed each line of a file. 5. Undoing Changes & Resetting 📌 git reset --soft HEAD~1 – Undo last commit but keep changes staged. 📌 git reset --hard HEAD~1 – Undo last commit and remove changes. 📌 git revert <commit_id> – Revert changes without losing history. 📌 git restore <file> – Undo changes in a file. 6. Stashing Changes 📌 git stash – Temporarily save changes without committing. 📌 git stash list – View saved stashes. 📌 git stash pop – Apply the last stash and remove it. 7. Tags & Releases 📌 git tag <tag_name> – Create a tag for a specific commit. 📌 git tag -a <tag_name> -m "message" – Annotated tag with description. 📌 git push origin --tags – Push all tags to the remote repository. 8. Git Hooks & Automation 📌 git pre-commit – Runs scripts before a commit. 📌 git post-commit – Runs scripts after a commit. 📌 git pre-push – Runs checks before pushing to remote. 9. Handling Merge Conflicts 📌 git mergetool – Open a merge conflict resolution tool. 📌 git merge --abort – Cancel a merge. 📌 git diff <branch_1> <branch_2> – Compare differences between branches. 10. Git & DevOps 📌 git fetch --all – Fetch changes from all remotes. 📌 git rebase <branch> – Reapply commits on top of another branch. 📌 git cherry-pick <commit_id> – Apply a specific commit from another branch. Follow Harshit Mundra for more helpful content. hashtag #GitCommands #OpenSource #GitWorkflow
To view or add a comment, sign in
-
Master Git with These Essential Commands! 🖥️ 1. Basic Git Commands 📌 git init – Initialize a Git repository. 📌 git clone <repo_url> – Clone a repository to your local machine. 📌 git status – Check the current state of your repository. 📌 git add <file> – Stage changes for commit. 📌 git commit -m "message" – Save changes with a commit message. 📌 git push – Upload local commits to a remote repository. 📌 git pull – Download and merge changes from a remote repository. 2. Branching & Merging 📌 git branch – List branches. 📌 git branch <branch_name> – Create a new branch. 📌 git checkout <branch_name> – Switch to another branch. 📌 git checkout -b <branch_name> – Create and switch to a new branch. 📌 git merge <branch_name> – Merge changes from another branch. 3. Remote Repository Management 📌 git remote -v – View remote repositories. 📌 git remote add <name> <url> – Add a remote repository. 📌 git push origin <branch> – Push changes to a remote branch. 📌 git pull origin <branch> – Pull changes from a remote branch. 4. Viewing & Comparing Changes 📌 git log – View commit history. 📌 git log --oneline – View a simplified commit history. 📌 git diff – Show changes between commits or branches. 📌 git blame <file> – Show who changed each line of a file. 5. Undoing Changes & Resetting 📌 git reset --soft HEAD~1 – Undo last commit but keep changes staged. 📌 git reset --hard HEAD~1 – Undo last commit and remove changes. 📌 git revert <commit_id> – Revert changes without losing history. 📌 git restore <file> – Undo changes in a file. 6. Stashing Changes 📌 git stash – Temporarily save changes without committing. 📌 git stash list – View saved stashes. 📌 git stash pop – Apply the last stash and remove it. 7. Tags & Releases 📌 git tag <tag_name> – Create a tag for a specific commit. 📌 git tag -a <tag_name> -m "message" – Annotated tag with description. 📌 git push origin --tags – Push all tags to the remote repository. 8. Git Hooks & Automation 📌 git pre-commit – Runs scripts before a commit. 📌 git post-commit – Runs scripts after a commit. 📌 git pre-push – Runs checks before pushing to remote. 9. Handling Merge Conflicts 📌 git mergetool – Open a merge conflict resolution tool. 📌 git merge --abort – Cancel a merge. 📌 git diff <branch_1> <branch_2> – Compare differences between branches. 10. Git & DevOps 📌 git fetch --all – Fetch changes from all remotes. 📌 git rebase <branch> – Reapply commits on top of another branch. 𝑷𝒍𝒂𝒚𝒘𝒓𝒊𝒈𝒉𝒕 𝒘𝒊𝒕𝒉 𝑱𝒂𝒗𝒂𝑺𝒄𝒓𝒊𝒑𝒕& 𝑻𝒚𝒑𝒆𝑺𝒄𝒓𝒊𝒑𝒕 ( 𝑨𝑰 𝒊𝒏 𝑻𝒆𝒔𝒕𝒊𝒏𝒈, 𝑮𝒆𝒏𝑨𝑰, 𝑷𝒓𝒐𝒎𝒑𝒕 𝑬𝒏𝒈𝒊𝒏𝒆𝒆𝒓𝒊𝒏𝒈)—𝑻𝒓𝒂𝒊𝒏𝒊𝒏𝒈 𝑺𝒕𝒂𝒓𝒕𝒔 𝒇𝒓𝒐𝒎 20𝒕𝒉 𝑨𝒑𝒓𝒊𝒍 𝑹𝒆𝒈𝒊𝒔𝒕𝒆𝒓 𝒏𝒐𝒘 𝒕𝒐 𝒂𝒕𝒕𝒆𝒏𝒅 𝑭𝒓𝒆𝒆 𝑫𝒆𝒎𝒐: https://lnkd.in/dR3gr3-4 𝑶𝑹 𝑱𝒐𝒊𝒏 𝒕𝒉𝒆 𝑾𝒉𝒂𝒕𝒔𝑨𝒑𝒑 𝒈𝒓𝒐𝒖𝒑 𝒇𝒐𝒓 𝒕𝒉𝒆 𝒍𝒂𝒕𝒆𝒔𝒕 𝑼𝒑𝒅𝒂𝒕𝒆: https://lnkd.in/ddHf2hdv #GitCommands #OpenSource #GitWorkflow
To view or add a comment, sign in
-
🚨 Most developers overcomplicate Git. by Harish kumar But 99% of your work runs on just these commands. After 4+ years, this is the only workflow I actually use. Simple. Repeatable. Effective. If you master this → you stop Googling eve 𝟭. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged. 𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all tracked changes with a message. 𝟯. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: Show the state of your working directory. 𝟰. 𝗴𝗶𝘁 𝗮𝗱𝗱 𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵:Add file(s) to the staging area. 𝟱. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Create and switch to a new branch. 𝟲. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Switch to an existing branch. 𝟳. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 --𝗮𝗺𝗲𝗻𝗱:Modify the last commit. 𝟴. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Push a branch to a remote. 𝟵. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Fetch and merge remote changes. 𝟭𝟬. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively, rewrite commit history. 𝟭𝟭. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲: Create a local copy of a remote repo. 𝟭𝟮. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲: Merge branches together. 𝟭𝟯. 𝗴𝗶𝘁 𝗹𝗼𝗴 --𝘀𝘁𝗮𝘁: Show commit logs with stats. 𝟭𝟰. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵: Stash changes for later. 𝟭𝟱. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes. 𝟭𝟲. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Show details about a commit. 𝟭𝟳. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit, preserving changes locally. 𝟭𝟴. 𝗴𝗶𝘁 𝗳𝗼𝗿𝗺𝗮𝘁-𝗽𝗮𝘁𝗰𝗵 -𝟭 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Create a patch file for a specific commit. 𝟭𝟵. 𝗴𝗶𝘁 𝗮𝗽𝗽𝗹𝘆 𝗽𝗮𝘁𝗰𝗵_𝗳𝗶𝗹𝗲_𝗻𝗮𝗺𝗲: Apply changes from a patch file. 𝟮𝟬. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Delete a branch forcefully. 𝟮𝟭. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁: Undo commits by moving branch reference. 𝟮𝟮. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁: Undo commits by creating a new commit. 𝟮𝟯. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆-𝗽𝗶𝗰𝗸 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Apply changes from a specific commit. 𝟮𝟰. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: Lists branches. 𝟮𝟱. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Resets everything to a previous commit, erasing all uncommitted changes. 𝟮𝟲. 𝗴𝗶𝘁 𝗳𝗲𝘁𝗰𝗵 Fetch latest changes from remote without merging. 𝟮𝟳. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 Reapply commits on top of another base branch (clean history). 𝟮𝟴. 𝗴𝗶𝘁 𝗿𝗲𝗳𝗹𝗼𝗴 View history of HEAD movements (lifesaver for recovery). 𝟮𝟵. 𝗴𝗶𝘁 𝗰𝗹𝗲𝗮𝗻 -𝗳𝗱 Remove untracked files and directories. 𝟯𝟬. 𝗴𝗶𝘁 𝘁𝗮𝗴 Create and manage version tags (useful for releases). ♻ Repost this to help your dev friends 👍 Save it for your next coding session 💬 Which Git command do you use the most? Follow Harish Kumar for more information
To view or add a comment, sign in
-
-
🚨 Most developers overcomplicate Git. But 99% of your work runs on just these commands. After 4+ years, this is the only workflow I actually use. Simple. Repeatable. Effective. If you master this → you stop Googling eve 𝟭. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged. 𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all tracked changes with a message. 𝟯. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: Show the state of your working directory. 𝟰. 𝗴𝗶𝘁 𝗮𝗱𝗱 𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵:Add file(s) to the staging area. 𝟱. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Create and switch to a new branch. 𝟲. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Switch to an existing branch. 𝟳. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 --𝗮𝗺𝗲𝗻𝗱:Modify the last commit. 𝟴. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Push a branch to a remote. 𝟵. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Fetch and merge remote changes. 𝟭𝟬. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively, rewrite commit history. 𝟭𝟭. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲: Create a local copy of a remote repo. 𝟭𝟮. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲: Merge branches together. 𝟭𝟯. 𝗴𝗶𝘁 𝗹𝗼𝗴 --𝘀𝘁𝗮𝘁: Show commit logs with stats. 𝟭𝟰. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵: Stash changes for later. 𝟭𝟱. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes. 𝟭𝟲. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Show details about a commit. 𝟭𝟳. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit, preserving changes locally. 𝟭𝟴. 𝗴𝗶𝘁 𝗳𝗼𝗿𝗺𝗮𝘁-𝗽𝗮𝘁𝗰𝗵 -𝟭 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Create a patch file for a specific commit. 𝟭𝟵. 𝗴𝗶𝘁 𝗮𝗽𝗽𝗹𝘆 𝗽𝗮𝘁𝗰𝗵_𝗳𝗶𝗹𝗲_𝗻𝗮𝗺𝗲: Apply changes from a patch file. 𝟮𝟬. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Delete a branch forcefully. 𝟮𝟭. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁: Undo commits by moving branch reference. 𝟮𝟮. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁: Undo commits by creating a new commit. 𝟮𝟯. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆-𝗽𝗶𝗰𝗸 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Apply changes from a specific commit. 𝟮𝟰. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: Lists branches. 𝟮𝟱. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Resets everything to a previous commit, erasing all uncommitted changes. 𝟮𝟲. 𝗴𝗶𝘁 𝗳𝗲𝘁𝗰𝗵 Fetch latest changes from remote without merging. 𝟮𝟳. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 Reapply commits on top of another base branch (clean history). 𝟮𝟴. 𝗴𝗶𝘁 𝗿𝗲𝗳𝗹𝗼𝗴 View history of HEAD movements (lifesaver for recovery). 𝟮𝟵. 𝗴𝗶𝘁 𝗰𝗹𝗲𝗮𝗻 -𝗳𝗱 Remove untracked files and directories. 𝟯𝟬. 𝗴𝗶𝘁 𝘁𝗮𝗴 Create and manage version tags (useful for releases). ♻ Repost this to help your dev friends 👍 Save it for your next coding session 💬 Which Git command do you use the most? Follow Harish Kumar for more information
To view or add a comment, sign in
-
-
Git is one of the most important tools for developers. This cheat sheet covers commonly used commands clearly. Sharing with my network.
Helping 532K+ Professionals Navigate AI & Tech| ATS Resume Expert | Land Your Dream Job Faster| Weekly AI Insights | Open for Brand Collaborations
🚨 Most developers overcomplicate Git. But 99% of your work runs on just these commands. After 4+ years, this is the only workflow I actually use. Simple. Repeatable. Effective. If you master this → you stop Googling eve 𝟭. 𝗴𝗶𝘁 𝗱𝗶𝗳𝗳: Show file differences not yet staged. 𝟮. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 -𝗮 -𝗺 "𝗰𝗼𝗺𝗺𝗶𝘁 𝗺𝗲𝘀𝘀𝗮𝗴𝗲": Commit all tracked changes with a message. 𝟯. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘁𝘂𝘀: Show the state of your working directory. 𝟰. 𝗴𝗶𝘁 𝗮𝗱𝗱 𝗳𝗶𝗹𝗲_𝗽𝗮𝘁𝗵:Add file(s) to the staging area. 𝟱. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 -𝗯 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Create and switch to a new branch. 𝟲. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗰𝗸𝗼𝘂𝘁 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Switch to an existing branch. 𝟳. 𝗴𝗶𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 --𝗮𝗺𝗲𝗻𝗱:Modify the last commit. 𝟴. 𝗴𝗶𝘁 𝗽𝘂𝘀𝗵 𝗼𝗿𝗶𝗴𝗶𝗻 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Push a branch to a remote. 𝟵. 𝗴𝗶𝘁 𝗽𝘂𝗹𝗹: Fetch and merge remote changes. 𝟭𝟬. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 -𝗶: Rebase interactively, rewrite commit history. 𝟭𝟭. 𝗴𝗶𝘁 𝗰𝗹𝗼𝗻𝗲: Create a local copy of a remote repo. 𝟭𝟮. 𝗴𝗶𝘁 𝗺𝗲𝗿𝗴𝗲: Merge branches together. 𝟭𝟯. 𝗴𝗶𝘁 𝗹𝗼𝗴 --𝘀𝘁𝗮𝘁: Show commit logs with stats. 𝟭𝟰. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵: Stash changes for later. 𝟭𝟱. 𝗴𝗶𝘁 𝘀𝘁𝗮𝘀𝗵 𝗽𝗼𝗽: Apply and remove stashed changes. 𝟭𝟲. 𝗴𝗶𝘁 𝘀𝗵𝗼𝘄 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Show details about a commit. 𝟭𝟳. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 𝗛𝗘𝗔𝗗~𝟭: Undo the last commit, preserving changes locally. 𝟭𝟴. 𝗴𝗶𝘁 𝗳𝗼𝗿𝗺𝗮𝘁-𝗽𝗮𝘁𝗰𝗵 -𝟭 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Create a patch file for a specific commit. 𝟭𝟵. 𝗴𝗶𝘁 𝗮𝗽𝗽𝗹𝘆 𝗽𝗮𝘁𝗰𝗵_𝗳𝗶𝗹𝗲_𝗻𝗮𝗺𝗲: Apply changes from a patch file. 𝟮𝟬. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵 -𝗗 𝗯𝗿𝗮𝗻𝗰𝗵_𝗻𝗮𝗺𝗲: Delete a branch forcefully. 𝟮𝟭. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁: Undo commits by moving branch reference. 𝟮𝟮. 𝗴𝗶𝘁 𝗿𝗲𝘃𝗲𝗿𝘁: Undo commits by creating a new commit. 𝟮𝟯. 𝗴𝗶𝘁 𝗰𝗵𝗲𝗿𝗿𝘆-𝗽𝗶𝗰𝗸 𝗰𝗼𝗺𝗺𝗶𝘁_𝗶𝗱: Apply changes from a specific commit. 𝟮𝟰. 𝗴𝗶𝘁 𝗯𝗿𝗮𝗻𝗰𝗵: Lists branches. 𝟮𝟱. 𝗴𝗶𝘁 𝗿𝗲𝘀𝗲𝘁 --𝗵𝗮𝗿𝗱: Resets everything to a previous commit, erasing all uncommitted changes. 𝟮𝟲. 𝗴𝗶𝘁 𝗳𝗲𝘁𝗰𝗵 Fetch latest changes from remote without merging. 𝟮𝟳. 𝗴𝗶𝘁 𝗿𝗲𝗯𝗮𝘀𝗲 Reapply commits on top of another base branch (clean history). 𝟮𝟴. 𝗴𝗶𝘁 𝗿𝗲𝗳𝗹𝗼𝗴 View history of HEAD movements (lifesaver for recovery). 𝟮𝟵. 𝗴𝗶𝘁 𝗰𝗹𝗲𝗮𝗻 -𝗳𝗱 Remove untracked files and directories. 𝟯𝟬. 𝗴𝗶𝘁 𝘁𝗮𝗴 Create and manage version tags (useful for releases). ♻ Repost this to help your dev friends 👍 Save it for your next coding session 💬 Which Git command do you use the most? Follow Harish Kumar for more information
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
GIT