🧠 Git Cheatsheet – Essential Commands Every Developer Should Know Git is no longer optional — it’s a core skill for developers, students, and engineers working on real-world projects. This cheatsheet highlights the most useful Git commands you’ll actually use in daily development 👇 --- 📁 Repository Setup git init → Initialize a repository git clone <url> → Clone a remote repository git config --global user.name "Name" git config --global user.email "email" --- ⚡ Basic Commands git status → Check file status git add <file> / git add . → Stage changes git commit -m "msg" → Commit changes git log → View commit history git diff → Show changes --- 🌿 Branching git branch → List branches git branch <name> → Create a branch git checkout <branch> → Switch branches git checkout -b <name> → Create & switch git merge <branch> → Merge branches git branch -d <name> → Delete branch --- 🌍 Remote Operations git remote -v → View remote URLs git push <remote> <branch> → Push code git pull <remote> <branch> → Pull updates git fetch → Fetch changes --- ⏪ Undo Changes git reset <file> → Unstage file git reset --hard → Reset everything git checkout <file> → Discard local changes git revert <commit> → Safely revert a commit --- 🚀 Advanced Commands git stash / git stash pop → Save & restore work git rebase <branch> → Rebase branch git tag <name> → Create tags git log --oneline → Compact commit history --- 📌 Beginner tip: Don’t try to memorize Git. Use it daily while building projects — confidence comes naturally. Save this post 🔖 — it will save you time later. --- #git #github #versioncontrol #developer #programming #coding #softwareengineering #webdevelopment #devlife #csstudents #techskills
Git Essential Commands for Developers
More Relevant Posts
-
90% of developers use Git daily, but only 10% actually understand it. You don’t need to know 100 commands; you need the right 20–30 that truly matter. Here’s the Git cheat sheet I wish someone had given me earlier. The Everyday Commands (You use these 80% of the time): - git status – What did I just break? - git add . – Stage everything - git commit -m "message" – Save your progress - git diff – What exactly changed? - git log --oneline – Clean commit history Branch Like a Pro: - git checkout -b feature/login – Create new branch - git branch – List branches - git merge branch_name – Merge code - git branch -D branch_name – Delete branch Working With Remote: - git clone repo_url – Get the code - git push origin branch – Send your work - git pull – Get latest updates - git fetch – Check updates safely Level Up Commands (Most devs avoid these): - git rebase -i – Clean messy commit history - git commit --amend – Fix last commit - git cherry-pick commit_id – Copy one commit - git stash / git stash pop – Pause work temporarily When Things Go Wrong (And they will): - git reset --soft HEAD^ – Undo commit safely - git reset --hard – Nuclear option - git revert commit_id – Undo without rewriting history Real power move? If you deeply understand reset, rebase, and cherry-pick, you’re already ahead of most developers. Save this post for later. Share it with a teammate who still fears Git. Which Git command do you use the most ? #Git #SoftwareEngineering #Developers #Coding #Programming #TechCareers #FullStack
To view or add a comment, sign in
-
🚀 PROJECT HIGHLIGHT(CI/CD PIPELINE WITH GITHUB ACTIONS + GITHUB PAGES) It's the weekend, and it's time to put out a simple project for newbies to practice with primary focus on CI/CD. I built an end-to-end CI/CD pipeline for a static React application (restaurant UI with menu, ordering, and user profiles). The goal wasn’t the UI; it was providing automation, reliability, and secure delivery. 🏗️WHAT I IMPLEMENTED - Git workflow with SSH authentication - Automated pipeline triggered on main push - Dependency install with npm ci (reproducible builds) - ESLint linting + Jest tests - Static build + automatic deployment to GitHub Pages 👨💻TECH STACK • Ubuntu 22.04 • Git/GitHub • Node.js 20 • React • GitHub Actions (YAML) • GitHub Pages • Docker (local testing) 🛠️PROBLEMS SOLVED - Fixed deployment permission failure by configuring workflow token scopes - Resolved Node version mismatch between local and CI - Automated lint corrections with pre-commit hooks 📓CHALLENGES & DEBUGGING This project wasn’t just building a pipeline; it was diagnosing real production-style failures. • DEPLOYMENT PERMISSION FAILURE GitHub Actions couldn’t publish to GitHub Pages due to missing repo write access. Fix: Granted GITHUB_TOKEN permissions (contents & pages), pinned action versions, and later used a Personal Access Token (PAT) for reliable deployment. • NODE VERSION MISMATCH Local app worked, but CI builds failed because Actions used an older Node version. Fix: Explicitly set node-version: 20 in the workflow. • NPM DEPENDENCY CONFLICT(ERESOLVE) react-scripts conflicted with the installed TypeScript version. Fix: Downgraded TypeScript to a compatible version and rebuilt lock files. • GIT DIVERGENT BRANCHES Local and remote branches conflicted during pull. Fix: Configured git pull --rebase strategy to maintain a clean commit history. 🤔WHY THIS MATTERS Every commit now lints → tests → builds → deploys automatically. No manual uploads, no environment drift, and failures are caught before release. This project demonstrates: ✔ CI/CD automation ✔ Secure build practices ✔ Debugging production-like failures ✔ Reproducible deployments #DevOps #CICD #GitHubActions #CloudNative #Automation
To view or add a comment, sign in
-
-
GIT COMMANDS — The Simple Version You Actually Needed 📌 Imagine you're doing a group assignment. ➖ There’s a shared Google Doc. ➖ You and your teammates are all editing it. Now link each Git command to something you’ve actually done before. 🧬 CLONE → “Copy it to my laptop” First day on the project. You download the shared document to your computer so you can work on it. 👉 git clone = Copy the whole project to your machine. Think: GIT CLONE = Copy the whole thing. 👀 STATUS → “What have I changed?” You pause and look at your document. What did I edit? What haven’t I saved? What’s different? 👉 GIT STATUS = Check what’s going on. Think: Status = Situation check. 📦 COMMIT → “Save my progress” You’ve made edits. Before sending it to the group, you save it properly and label it: “Updated intro – fixed grammar.” 👉 GIT COMMIT = Save changes locally with a message. Think: Commit = Lock it in. ⬆️ PUSH → “Send it to the group” Now you upload your updated version to the shared doc so everyone can see it. 👉 GIT PUSH = Send your saved changes to the remote repo. Think: Push = Push it out. ⬇️ PULL → “Get the latest version” Your teammate updated something. Before continuing, you refresh and get the newest version. 👉 GIT PULL = Bring the latest changes to your machine. Think: Pull = Pull it down. 🔀 CHECKOUT → “Switch versions” You stop working on the main document. You switch to a new draft version called: “New Conclusion Draft” 👉 GIT CHECKOUT = Switch branches. Think: Checkout = Change lanes. 🤝 MERGE → “Combine the work” Your draft is approved. You combine your changes into the main document. 👉 git MERGE = Combine branches. Think: Merge = Mix it together. #Git #DevOps #Programming #CloudComputing #TechLearning #DeveloperLife
To view or add a comment, sign in
-
-
🚀 From Just Saving Files to Understanding Version Control – "My Git & GitHub Journey" There was a time when I used to save my projects as: "final .java" "final_updated .java" "final_final .java" And honestly… I still wasn’t sure which file was the correct one. I never realized how inefficient that was until I started learning Git & GitHub through a detailed YouTube class. That’s when I understood that real developers don’t manage projects by duplicating files — they use version control. At first, Git felt a little confusing — staging area? branches? commits? It sounded technical and overwhelming. But as I kept practicing alongside the sessions, things slowly started making sense. I realized something important: "Git is not just about commands. It’s about confidence." Instead of being scared to change my code, I now understand how to manage it safely. Through this learning journey, I understood how to: 🔹 Track changes properly instead of creating multiple copies 🔹 Write meaningful commits that explain what I changed 🔹 Work on new features using branches without affecting the main code 🔹 Push my projects to GitHub and maintain them professionally 🔹 Collaborate using pull requests in a structured way What really changed my perspective was understanding how powerful version control is in team environments. In real-world projects, multiple developers work on the same codebase. Without Git, managing that would be chaotic. Whether it's fixing bugs, experimenting with new features, or reviewing code — Git makes everything organized and manageable. As someone actively working on projects in Cybersecurity, AI, and Backend Development, this learning experience has strengthened my development workflow. It has made my projects look more professional and structured. The biggest shift? I’m no longer afraid to experiment. Because now I know I can always track, revert, and manage changes effectively. Still learning. Still improving. But definitely leveling up. 🚀 #Git #GitHub #VersionControl #SoftwareDevelopment #LearningJourney #WomenInTech #TechSkills
To view or add a comment, sign in
-
-
𝐆𝐢𝐭 𝐅𝐞𝐭𝐜𝐡 𝐯𝐬 𝐆𝐢𝐭 𝐏𝐮𝐥𝐥 — 𝐎𝐧𝐞 𝐒𝐦𝐚𝐥𝐥 𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐜𝐞, 𝐁𝐢𝐠 𝐈𝐦𝐩𝐚𝐜𝐭 A lot of Git confusion starts right here. Many developers assume 𝐠𝐢𝐭 𝐟𝐞𝐭𝐜𝐡 and 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥 do the same thing. But They don’t — and that misunderstanding causes most Git-related issues in teams. When you run 𝐠𝐢𝐭 𝐟𝐞𝐭𝐜𝐡, Git only communicates with the remote repository. It downloads the latest commits and updates your local reference (origin/main). Your working code remains untouched. No files change. No conflicts. No surprises. Now comes 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥. 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥 goes a step further. It fetches the changes and immediately merges them into your current branch. 𝐓𝐡𝐚𝐭’𝐬 𝐰𝐡𝐲: • Files suddenly change • Merge conflicts appear • People feel Git is unpredictable In reality, Git is being precise — not random. The key line every engineer should remember: 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥 = 𝐠𝐢𝐭 𝐟𝐞𝐭𝐜𝐡 + 𝐠𝐢𝐭 𝐦𝐞𝐫𝐠𝐞 𝐓𝐡𝐢𝐬 𝐢𝐬 𝐰𝐡𝐲 𝐦𝐚𝐧𝐲 𝐞𝐱𝐩𝐞𝐫𝐢𝐞𝐧𝐜𝐞𝐝 𝐞𝐧𝐠𝐢𝐧𝐞𝐞𝐫𝐬 𝐩𝐫𝐞𝐟𝐞𝐫 𝐭𝐨: • Run git fetch • Review the incoming changes • Merge only when they’re ready Same commands. Different level of control. Once this concept is clear, Git stops feeling confusing and starts feeling reliable. #Git #DevOps #SoftwareEngineering #VersionControl #Engineering #Tech
To view or add a comment, sign in
-
-
Most developers use Git every day. But only a few actually understand its power. Here are 15 Git commands every developer should master 👇 1. git init Initialize a new Git repository. 2. git clone <repo_url> Copy an existing repository from GitHub to your local machine. 3. git status Shows modified, staged, and untracked files. 4. git add <file> Adds a file to the staging area. 5. git add . Adds all changed files to staging. 6. git commit -m "message" Creates a snapshot of your staged changes. 7. git push Uploads your commits to remote repository. 8. git pull Fetches and merges latest changes from remote. 9. git fetch Downloads latest changes without merging. Safer than pull when reviewing changes. 10. git branch Lists or creates branches. 11. git checkout <branch> Switch to another branch. 12. git checkout -b <branch> Create and switch to new branch instantly. 13. git merge <branch> Merge another branch into current branch. 14. git log Shows commit history. Helps understand who changed what. 15. git reset --hard HEAD Undo changes and reset to last commit. Use carefully ⚠️ Git was created by and powers modern development on platforms like . If you master these 15 commands, you’re already ahead of 80% of developers. Save this post. You’ll need it later. Which Git command do you use the most? 👇 #git #github #programming #developer #softwareengineering #coding #devops #webdevelopment #tech #learncodingIf
To view or add a comment, sign in
-
-
Most developers use Git every day. But only a few actually understand its power. Here are 15 Git commands every developer should master 👇 1. git init Initialize a new Git repository. 2. git clone <repo_url> Copy an existing repository from GitHub to your local machine. 3. git status Shows modified, staged, and untracked files. 4. git add <file> Adds a file to the staging area. 5. git add . Adds all changed files to staging. 6. git commit -m "message" Creates a snapshot of your staged changes. 7. git push Uploads your commits to remote repository. 8. git pull Fetches and merges latest changes from remote. 9. git fetch Downloads latest changes without merging. Safer than pull when reviewing changes. 10. git branch Lists or creates branches. 11. git checkout <branch> Switch to another branch. 12. git checkout -b <branch> Create and switch to new branch instantly. 13. git merge <branch> Merge another branch into current branch. 14. git log Shows commit history. Helps understand who changed what. 15. git reset --hard HEAD Undo changes and reset to last commit. Use carefully ⚠️ Git was created by and powers modern development on platforms like . If you master these 15 commands, you’re already ahead of 80% of developers. Save this post. You’ll need it later. Which Git command do you use the most? 👇 #git #github #programming #developer #softwareengineering #coding #devops #webdevelopment #tech #learncodingIf
To view or add a comment, sign in
-
-
Most developers use Git every day. But only a few actually understand its power. Here are 15 Git commands every developer should master 👇 1. git init Initialize a new Git repository. 2. git clone <repo_url> Copy an existing repository from GitHub to your local machine. 3. git status Shows modified, staged, and untracked files. 4. git add <file> Adds a file to the staging area. 5. git add . Adds all changed files to staging. 6. git commit -m "message" Creates a snapshot of your staged changes. 7. git push Uploads your commits to remote repository. 8. git pull Fetches and merges latest changes from remote. 9. git fetch Downloads latest changes without merging. Safer than pull when reviewing changes. 10. git branch Lists or creates branches. 11. git checkout <branch> Switch to another branch. 12. git checkout -b <branch> Create and switch to new branch instantly. 13. git merge <branch> Merge another branch into current branch. 14. git log Shows commit history. Helps understand who changed what. 15. git reset --hard HEAD Undo changes and reset to last commit. Use carefully ⚠️ Git was created by and powers modern development on platforms like . If you master these 15 commands, you’re already ahead of 80% of developers. Save this post. You’ll need it later. Which Git command do you use the most? 👇 #git #github #programming #developer #softwareengineering #coding #devops #webdevelopment #tech #learncodingIf
To view or add a comment, sign in
-
-
Git Cheat Sheet Essential Commands Every Developer Must Know Git is a must-have skill for every developer not just for storing code, but for collaboration, version control, and safe deployments. This Git Cheat Sheet covers the most commonly used Git commands that you’ll use daily in real projects and interviews. 🔹 What You’ll Find Inside: ✔ Repository setup (git init, git clone) ✔ Daily workflow (status, add, commit, push, pull) ✔ Branching & merging (branch, checkout, merge, rebase) ✔ Undo & recovery (reset, revert, stash) ✔ Remote repositories (origin, fetch, pull) ✔ Best practices for clean commit history 🎯 Who Is This For? Beginners learning Git Frontend & backend developers Engineers preparing for interviews Teams working on collaborative projects 📌 Pro Tip: If you understand Git, you fear breaking code a lot less. #Git #GitHub #VersionControl #DeveloperTools #Programming #WebDevelopment #Coding
To view or add a comment, sign in
-
I've used git for 7 years, but this feature is SO underrated: ___ btw, my free interview cheatsheet: https://lnkd.in/d_eCGEJR ___ git worktrees. Most developers treat their repo like a single workspace. One branch checked out. One context at a time. That worked fine when YOU were the only one writing code. But now you've got 3 AI agents running in parallel: → One refactoring your auth module → One spiking a new feature → One writing tests All in the same repo. All fighting over the same files. Git worktrees fix this. Instead of switching branches, you check out multiple branches simultaneously in separate folders. Same repo. Same git history. Different working directories. Your main stays untouched while agents go wild in isolated sandboxes. The setup takes 10 seconds: git worktree add ../feature-auth feature/auth git worktree add ../spike-payments spike/payments git worktree add ../test-coverage test/add-coverage Now each agent has its own playground. No stashing. No conflicts. No "which branch am I on?" panic. When the work is done, merge it or nuke it. git worktree remove ../spike-payments The developers shipping fastest with AI aren't writing more code. They're running more experiments in parallel. Do you use worktrees?
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