💻 Git Workflow: Essential Commands Every Developer Should Know Git has dozens of commands, but in daily development most workflows rely on a small core set. The real challenge is not remembering commands. It is understanding where your code moves after each command. In Git, your code typically moves between four places: • Working Directory → your local files • Staging Area → files prepared for commit • Local Repository → saved commits on your machine • Remote Repository → shared code (GitHub, GitLab, Azure DevOps) Once you understand this flow, Git becomes much easier. 📦 Saving Your Work git add Moves changes from the working directory → staging area git commit Saves staged changes into the local repository git push Uploads your commits from local repository → remote repository 📥 Getting a Project git clone Downloads the entire remote repository to your machine. git checkout Switches to a specific branch or commit. 🔄 Syncing Changes git fetch Downloads updates from the remote repository without modifying your working files. git merge Combines fetched changes with your current branch. git pull A shortcut for: git fetch + git merge 🧰 The Safety Net git stash Temporarily saves uncommitted changes so you can switch branches without losing work. git stash apply Restores the saved changes. git stash pop Restores the changes and removes them from stash. 💡 Key Insight Git commands are simple once you understand how code flows between the working directory, staging area, and repositories. Most Git mistakes happen when developers run commands without knowing where their changes are stored. Master these few commands, and you can handle most real-world Git workflows confidently. #Git #SoftwareDevelopment #Programming #Developers #VersionControl #Coding PC: Alex Xu
Mastering Git Workflow with Essential Commands
More Relevant Posts
-
Git Series | Day 1: Architecture of Collaboration — From VCS to Distributed Git 🌐 Today, I officially moved beyond local administration into the "Source of Truth" for all modern software development. I shifted from just saving files to understanding the Distributed Version Control System (DVCS) architecture that powers the global tech industry. 1. The Problem: Centralized VCS (The "Old Way") In a traditional VCS, developers are tethered to a single central server. If that server goes down, the entire team’s productivity stops. It represents a "Single Point of Failure" that modern, high-availability DevOps cannot afford. 2. The Solution: Distributed Git (The "New Way") Git revolutionized this by giving every developer a full copy of the repository on their Local System. • Reliability: If the main server fails, any local repository can be used to restore it completely. • Speed: Since the entire history is on my machine, operations like commits and logs happen at lightning speed without needing an internet connection. • Independence: I can work on "Updated Feedback" locally and sync with the remote server (GitHub/GitLab) only when the code is verified and ready. 3. The Developer's "Three Trees" I mastered the internal flow of how Git tracks work: • Working Directory: The actual folder where I am modifying my shell scripts. • Staging Area (Index): The "Waiting Room" where I selectively prepare changes before they are finalized. • Local Repo: The database where my code is officially snapshotted and timestamped as a Commit. #Git #VersionControl #DevOps #SystemArchitecture #100DaysOfCode #SoftwareEngineering #LinuxAdmin #GitHub
To view or add a comment, sign in
-
-
🚀Day 34/90 Days DevOps Challenge - Introduction to Git & Basic Commands Today I completed Shell Scripting and started a new tool: Git & GitHub. This marks a shift from scripting to version control, which is a core part of DevOps. Git is a distributed version control system used to track and manage changes in source code efficiently. 🔹 What Git Helps With It tracks: • Who made the changes (author) • What changes were made • When the changes were made It solves major problems like collaboration, tracking code history, and maintaining backups. 🔹 History of Git Before Git, developers faced issues in collaboration and version tracking. Tools like BitKeeper were used but had limitations. Git was introduced by Linus Torvalds in 2005 as a free and open-source solution. 🔹 Git Workflow (Very Important Concept) Working Directory → Staging Area → Local Repository → Remote Repository Understanding this flow is critical. If you skip this, Git will always confuse you. 🔹 Core Git Operations • Adding → Move files to staging area • Committing → Save changes in local repo • Pushing → Upload code to remote repo • Pulling → Download latest changes 🔹 Basic Commands I Practiced • git init → Initialize a repository • git config user.name / user.email → Set identity • git add <file> → Add file to staging • git add . → Add all files • git status → Check file status • git commit -m "message" → Save changes • git log → View commit history • git remote add origin <url> → Connect to GitHub • git remote -v → Verify remote connection • git push origin master → Push code to GitHub 💡Key Learning Git is not about memorizing commands. It’s about understanding the flow of how code moves from your system to a shared repository. 📌 Tomorrow’s Topic: pulling, fetch & cloning in Git #90DaysOfDevOps #DevOps #CICD #Docker #Kubernetes #AWS #terraform #ansible #prometheus #grafana #CloudComputing #InfrastructureAsCode #LearningInPublic #FreshGraduate #CloudEngineer #Linux #Git #GitHub #VersionControl
To view or add a comment, sign in
-
-
🚀 Git & GitHub Series – Part 2 (Core Commands + Real-Time Scenarios) Once you understand basics, the next step is mastering real-time Git usage — this is what companies actually expect. Let’s break it down 👇 🔹 Understanding “origin” (Very Important) origin is just a nickname for your GitHub repository Check connection: git remote -v 👉 Meaning: “Which GitHub repo is my local project connected to?” 🔹 Common Real-Time Problem 👉 You are trying to push code, but it goes to the wrong GitHub account ✔️ Solution: git remote remove origin git remote add origin <new-repo-url> 🔹 When Repo URL Changes git remote set-url origin <new-url> 👉 Used when: Switching GitHub accounts Repository URL updated 🔹 Core Git Commands (Must Know) 👉 Initialize project git init 👉 Add files git add . 👉 Commit changes git commit -m "your message" 👉 Push code git push -u origin main 🔹 Branch Handling (Important for Teams) 👉 Rename branch to main git branch -M main 👉 Push specific branch git push -u origin feature-login 🔹 Real-Time Workflow in Companies Clone repository Create feature branch Make changes Commit with proper message Push branch Create Pull Request (PR) Team reviews code Merge to main 🔹 Golden Rules (Follow Strictly in MNCs) ❌ Don’t push directly to main ❌ Don’t use personal email ❌ Don’t commit without meaningful message ✅ Always raise PR ✅ Follow team branching strategy 💡 Mastering these commands + scenarios = You are ready for real DevOps workflows and interviews 📌 Next: Advanced Git (Rebase, Merge conflicts, Cherry-pick) #DevOps #Git #GitHub #InterviewPrep #CI_CD #MNCJobs #SoftwareDevelopment
To view or add a comment, sign in
-
-
Some engineers might think Git is the only version control system. Back in 2010, when I started evaluating which system to adopt, the choice wasn’t nearly as obvious as it seems today. I spent quite a bit of time experimenting with Mercurial. Even back then, it was clear to me that SVN was already outdated. The developer experience of distributed systems was miles ahead. In the end, the decision wasn’t just about the tool itself, it was about the ecosystem around it. GitHub was only about 1–2 years old at the time, and GitLab emerging as an open-source alternative gave me confidence that Git was the right long-term bet. Big technical decisions shouldn’t be evaluated from just one angle. Some signals I usually look for: → How often do I see this technology appear in other contexts? → How good is the interface and developer experience? → How broad is the adoption? These signals aren’t perfect, but they’re usually better than chasing the latest hype.
To view or add a comment, sign in
-
-
This visual breaks down a tool that virtually every developer uses everyday. A reminder that good visualization can make even the most technical concepts easier to understand.
Git Workflow: Essential Commands Git has a lot of commands. Most workflows use a fraction of them. The part that causes problems isn't the commands themselves, it's not knowing where your code sits after running one. Working directory, staging area, local repo, remote repo. Each command moves code between these. Here's what each one does. - Saving Your Work: “git add” moves files from your working directory to the staging area. “git commit” saves those staged files to your local repository. “git push” uploads your commits to the remote repository - Getting a Project: “git clone” pulls down the entire remote repository to your machine. “git checkout” switches you to a specific branch. - Syncing Changes: “git fetch” downloads updates from remote but doesn't change your files. “git merge” integrates those changes. “git pull” does both at once. - The Safety Net: “git stash” is your undo button. It temporarily saves your uncommitted changes so you can switch contexts without losing work. “git stash apply” brings them back. “git stash pop” brings them back and deletes the stash. -- Subscribe to our weekly newsletter to get a Free System Design PDF (368 pages): https://lnkd.in/gauQcE45 #systemdesign #coding #interviewtips .
To view or add a comment, sign in
-
-
🔄 Git Workflow: Essential Commands Every Developer Should Know Git has many commands, but most daily workflows use only a small set. The real challenge is not remembering commands — it’s understanding where your code is after each command runs. Git works across four main areas: 1️⃣ Working Directory – Your local files and changes 2️⃣ Staging Area – Files prepared for commit 3️⃣ Local Repository – Commit history stored on your machine 4️⃣ Remote Repository – Shared code stored on platforms like GitHub or GitLab Each Git command simply moves changes between these areas. 💾 Saving Your Work git add Moves files from the working directory → staging area. git commit Stores staged changes in your local repository. git push Uploads your commits to the remote repository so others can see them. 📥 Getting a Project git clone Downloads the entire remote repository to your machine. git checkout Switches to another branch or version of the project. 🔄 Syncing Changes git fetch Downloads updates from remote without modifying your files. git merge Integrates those updates into your current branch. git pull Combination of fetch + merge in one command. 🛟 The Safety Net Sometimes you need to switch tasks without committing incomplete work. git stash Temporarily saves uncommitted changes. git stash apply Restores those changes. git stash pop Restores changes and removes them from the stash list. 🧠 Simple Way to Remember the Flow Working Directory ⬇ git add ⬇ Staging Area ⬇ git commit ⬇ Local Repository ⬇ git push ⬇ Remote Repository 💬 Your turn: Which Git command has saved you the most time — stash, rebase, or cherry-pick? 🏷️ #Git #DevOps #VersionControl #SoftwareEngineering #CloudEngineering #DeveloperTools
To view or add a comment, sign in
-
-
Many developers write Git Commit messages without any clear standard, which makes the project history look like this after a while 👇 git commit -m "fixed the bug" git commit -m "some changes" When anyone revisits this history — whether you or a teammate — no one will know what changed, why it changed, or when the problem started. This standard solves the problem completely 👇 📌 Conventional Commits Basic syntax: type: short description ───────────────────────────── Available types: feat: adding a new feature fix: fixing a bug refactor: restructuring code without changing behavior style: formatting changes only perf: performance improvements docs: updating documentation test: adding or modifying tests chore: configuration and secondary file changes ───────────────────────────── Examples: feat: add password visibility toggle to login form fix: clear cart and wishlist on logout refactor: extract filter logic into custom hook perf: memoize filtered products with useMemo docs: update README with new project structure style: update button hover color to match brand theme ───────────────────────────── Benefits: ✦ Clear and readable commit history for every team member ✦ Easily track changes and identify when issues started ✦ Automatic Changelog generation ✦ Standard used in most open source projects #Git #CleanCode #Programming #WebDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
🚀 Jenkins + GitHub Integration: Automate Your CI/CD In today’s fast-paced development world, automation is not optional — it’s essential. Integrating Jenkins with GitHub is a powerful way to streamline your CI/CD pipeline and ensure faster, more reliable deployments. 🔧 Why integrate Jenkins with GitHub? ✔️ Automatic build triggers on code commits ✔️ Continuous testing and early bug detection ✔️ Faster feedback loop for developers ✔️ Improved collaboration and code quality ⚙️ How it works (high level): 1️⃣ Push code to GitHub repository 2️⃣ GitHub webhook triggers Jenkins job 3️⃣ Jenkins pulls latest code 4️⃣ Build + Test execution starts automatically 5️⃣ Results are reported instantly 💻 Essential Jenkins Commands (Windows): 🔹 Start Jenkins (if installed as a service): net start Jenkins 🔹 Stop Jenkins: net stop Jenkins 🔹 Restart Jenkins: net stop Jenkins net start Jenkins 🔹 Check Jenkins Service Status: sc query Jenkins 🔹 Run Jenkins WAR File (Manual Start): java -jar jenkins.war 🔹 Find Initial Admin Password: Navigate to: C:\Program Files\Jenkins\secrets\initialAdminPassword 🔹 Run Jenkins CLI Command: Code java -jar jenkins-cli.jar -s http://localhost:8080/ help ⚡ Why these commands matter? ✔️ Quick troubleshooting ✔️ Better control over Jenkins server ✔️ Faster setup & maintenance ✔️ Essential for DevOps & Automation roles 💡 Pro Tips: 🔹 Use webhooks instead of polling for real-time triggers 🔹 Secure your integration with GitHub tokens 🔹 Maintain clean pipelines using Jenkinsfile (Pipeline as Code) 🔹 Add notifications (Slack/Email) for build status 📈 Result? Reduced manual effort, faster releases, and a more robust development lifecycle! If you're working in Automation Testing or DevOps, this integration is a must-have skill. #Jenkins #GitHub #CICD #DevOps #AutomationTesting #SoftwareTesting #ContinuousIntegration #ContinuousDelivery #
To view or add a comment, sign in
-
Key Git Workflow Stages 1. Saving Changes (The Local Loop) Working Directory: Where you actively edit files. They are "untracked" or "modified" here. Staging Area (Index): Using git add, you prepare specific changes for the next snapshot. Local Repository: Using git commit, changes are permanently recorded in your machine's history. Remote Repository: Using git push, your local commits are uploaded to a shared server (like GitHub or GitLab). 2. Synchronization & Collaboration git clone: Creates a local copy of an existing remote repository to start working. git fetch vs. git pull: * fetch downloads changes from the remote to a "tracking branch" without altering your work. pull (fetch + merge) immediately brings those remote changes into your active working directory. git merge: Integrates changes from one branch (often a remote tracking branch) into your current branch. 3. Undo & Temporary Operations git reset: Moves the current branch head to a previous state, effectively "undoing" local changes. The Stash: A "waiting room" for unfinished work. git stash: Temporarily shelves changes so you can switch branches with a clean directory. git stash apply/pop: Brings those stashed changes back when you're ready to resume. #Git #GitHub #VersionControl #WebDevelopment #SoftwareEngineering #DevOps #Programming #CodingTips #GitWorkflow #SoftwareDevelopment #TechTutorial #ByteByteGo #OpenSource #DeveloperTools #ComputerScience #TechCommunity #CI_CD #BackendDevelopment #FrontendDevelopment #FullStack
To view or add a comment, sign in
-
-
When Git finally makes sense, everything in your development workflow starts feeling easier. A lot of people find GitHub confusing at first, but once you understand the basics, everything becomes much more organized. 𝗛𝗲𝗿𝗲’𝘀 𝘁𝗵𝗲 𝘀𝗶𝗺𝗽𝗹𝗲𝘀𝘁 𝘄𝗮𝘆 𝘁𝗼 𝘁𝗵𝗶𝗻𝗸 𝗮𝗯𝗼𝘂𝘁 𝗶𝘁: - Repository → your project workspace - Commit → a saved snapshot of your progress - Branch → a safe parallel version for testing changes - Merge → combining updates from different branches - Push / Pull → syncing local and remote code 𝗚𝗶𝘁 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 𝗲𝘃𝗲𝗿𝘆 𝗯𝗲𝗴𝗶𝗻𝗻𝗲𝗿 𝘀𝗵𝗼𝘂𝗹𝗱 𝗸𝗻𝗼𝘄 - "git init" → create a new repository - "git clone <url>" → copy an existing repo to your system - "git status" → check modified files - "git add ." → stage all changes - "git commit -m "message"" → save your work with a note - "git push" → upload local changes - "git pull" → fetch the latest updates - "git branch" → view available branches - "git checkout -b dev" → create and switch to a new branch - "git merge dev" → merge branch changes 𝗣𝗿𝗮𝗰𝘁𝗶𝗰𝗮𝗹 𝗚𝗶𝘁 𝗵𝗮𝗯𝗶𝘁𝘀 𝘁𝗵𝗮𝘁 𝘀𝗮𝘃𝗲 𝘁𝗶𝗺𝗲 - Don’t run commands blindly—understand what each one does - Avoid working directly on "main"; use branches - Keep commit messages clear and meaningful - Always run "git status" before committing - Pull latest changes before pushing your code Small Git habits like these can save hours of debugging and confusion later. If this made Git simpler for you, repost it so it can help another developer too. Save this as a quick Git cheat sheet for your practice sessions. Comment “GitHub” and I’ll share the full beginner-friendly PDF. Follow for more simple tech tips and developer growth content. Arijit Ghosh Join my community for more resources: https://lnkd.in/ghHMXg2Q #Git #Github
To view or add a comment, sign in
More from this author
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