Git commands frequently utilized in a Software Engineer's daily workflow with 3+ years of experience: git diff: Show file differences that are not yet staged. git commit -a -m "commit message": Commit all tracked changes with a message. git status: Show the state of your working directory. git add file_path: Add file(s) to the staging area. git checkout -b branch_name: Create and switch to a new branch. git checkout branch_name: Switch to an existing branch. git commit --amend: Modify the last commit. git push origin branch_name: Push a branch to a remote repository. git pull: Fetch and merge remote changes. git rebase -i: Rebase interactively and rewrite commit history. git clone: Create a local copy of a remote repository. git merge: Merge branches together. git log --stat: Show commit logs with statistics. git stash: Temporarily store changes for later. git stash pop: Apply and remove stashed changes. git show commit_id: Show details about a commit. git reset HEAD~1: Undo the last commit while preserving changes locally. git format-patch -1 commit_id: Create a patch file for a specific commit. git apply patch_file_name: Apply changes from a patch file. git branch -D branch_name: Force delete a branch. git reset: Undo commits by moving the branch reference. git revert: Undo commits by creating a new commit. git cherry-pick commit_id: Apply changes from a specific commit. git branch: List branches. git reset --hard: Reset everything to a previous commit, erasing all uncommitted changes. While Git may initially appear complex, in practice, a select few powerful commands can effectively manage most real-world scenarios. #Git #GitWorkflow #SoftwareEngineering #WebDevelopment #DeveloperTools #Programming #Coding #SoftwareDeveloper #DevTips
Git Commands for Software Engineers: Essential Tools for Daily Workflow
More Relevant Posts
-
Cursor Rules: Automating the Deployment Checklist I’m moving from manual prompting to project-specific rules. Using .mdc files in Cursor, I’ve encoded my Git sequences to reduce shipping errors. Two rules I’ve implemented: "Push to Prod": Automates npm run build, reviews diffs, excludes .env, and handles the commit/push. It forces a build check every time. "Rollback and Sync": A hard reset for when local branches drift. It fetches from origin, resets the branch, and clears cached artifacts (.next). The Upgrade: "Apply Intelligently" By setting these to Apply Intelligently, I don't need to type a trigger phrase. Cursor detects the intent—like "shipping" or "cleaning up"—and automatically attaches the relevant rule to the context. The Takeaway: It’s not just about saving keystrokes. It’s about noticing recurring friction, versioning the fix, and letting the editor apply that logic exactly when it’s needed. Read the log: 👉 https://lnkd.in/gA2uNtbm #VibeCoding #CursorAI #BuildInPublic #GitWorkflow |
To view or add a comment, sign in
-
𝗠𝗼𝘀𝘁 𝗨𝘀𝗲𝗱 𝗚𝗶𝘁 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀 1. 𝐠𝐢𝐭 𝐝𝐢𝐟𝐟: Show file differences not yet staged. 2. 𝐠𝐢𝐭 𝐜𝐨𝐦𝐦𝐢𝐭 -𝐚 -𝐦 "𝐜𝐨𝐦𝐦𝐢𝐭 𝐦𝐞𝐬𝐬𝐚𝐠𝐞": Commit all tracked changes with a message. 3. 𝐠𝐢𝐭 𝐜𝐨𝐦𝐦𝐢𝐭 --𝐚𝐦𝐞𝐧𝐝: Modify the last commit. 4. 𝐠𝐢𝐭 𝐬𝐭𝐚𝐭𝐮𝐬: Show the state of your working directory. 5. 𝐠𝐢𝐭 𝐚𝐝𝐝 𝐟𝐢𝐥𝐞_𝐩𝐚𝐭𝐡: Add file(s) to the staging area. 6. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐜𝐤𝐨𝐮𝐭 -𝐛 𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞: Create and switch to a new branch. 7. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐜𝐤𝐨𝐮𝐭 𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞: Switch to an existing branch. 8. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐜𝐤𝐨𝐮𝐭 <𝐜𝐨𝐦𝐦𝐢𝐭>: Switches the working directory to a specific commit. 9. 𝐠𝐢𝐭 𝐩𝐮𝐬𝐡 𝐨𝐫𝐢𝐠𝐢𝐧 𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞: Push a branch to a remote. 10. 𝐠𝐢𝐭 𝐩𝐮𝐥𝐥: Fetch and merge remote changes. 11. 𝐠𝐢𝐭 𝐟𝐞𝐭𝐜𝐡: Fetch changes from the remote repository without merging. 12. 𝐠𝐢𝐭 𝐫𝐞𝐛𝐚𝐬𝐞 -𝐢: Rebase interactively, rewrite commit history. 13. 𝐠𝐢𝐭 𝐫𝐞𝐛𝐚𝐬𝐞 𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞: Rebase the current branch onto another branch. 14. 𝐠𝐢𝐭 𝐜𝐥𝐨𝐧𝐞: Create a local copy of a remote repo. 15. 𝐠𝐢𝐭 𝐦𝐞𝐫𝐠𝐞: Merge branches together. 16. 𝐠𝐢𝐭 𝐥𝐨𝐠 --𝐬𝐭𝐚𝐭: Show commit logs with stats. 17. 𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡: Stash changes for later. 18. 𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 𝐩𝐨𝐩: Apply and remove stashed changes. 19. 𝐠𝐢𝐭 𝐬𝐡𝐨𝐰 𝐜𝐨𝐦𝐦𝐢𝐭_𝐢𝐝: Show details about a commit. 20. 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭 𝐇𝐄𝐀𝐃~1: Undo the last commit, preserving changes locally. 21. 𝐠𝐢𝐭 𝐛𝐫𝐚𝐧𝐜𝐡 -𝐃 𝐛𝐫𝐚𝐧𝐜𝐡_𝐧𝐚𝐦𝐞: Delete a branch forcefully. 22. 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭: Undo commits by moving branch reference. 23. 𝐠𝐢𝐭 𝐫𝐞𝐯𝐞𝐫𝐭 𝐜𝐨𝐦𝐦𝐢𝐭_𝐢𝐝: Create a new commit that undoes the changes of a specific commit. 24. 𝐠𝐢𝐭 𝐜𝐡𝐞𝐫𝐫𝐲-𝐩𝐢𝐜𝐤 𝐜𝐨𝐦𝐦𝐢𝐭_𝐢𝐝: Apply changes from a specific commit. 24. 𝐠𝐢𝐭 𝐛𝐫𝐚𝐧𝐜𝐡: Lists branches. 26. 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭 --𝐬𝐨𝐟𝐭 𝐇𝐄𝐀𝐃^: Undo the last commit, but keep the changes. 27. 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭 --𝐡𝐚𝐫𝐝: Resets everything to a previous commit, erasing all uncommitted changes. 28: 𝐠𝐢𝐭 𝐛𝐫𝐚𝐧𝐜𝐡 --𝐬𝐞𝐭-𝐮𝐩𝐬𝐭𝐫𝐞𝐚𝐦-𝐭𝐨 𝐫𝐞𝐦𝐨𝐭𝐞_𝐛𝐫𝐚𝐧𝐜𝐡: Sets the upstream branch to the specified #DevOps #SoftwareEngineering #TechCommunity #git #versioncontrol #github #javascript #developers
To view or add a comment, sign in
-
Approving a Pull Request without running the tests locally is the software engineering equivalent of closing your eyes and crossing a busy street. 🙈🚦 When I was building the early versions of the Railway Management System, we had a strict rule: "Don't break the main branch." But developers are human. You write a brilliant new feature for seat reservations, forget to run mvn clean test, hit "Merge," and suddenly the entire booking API is throwing 500 Internal Server Error for everyone. That’s when I stopped trusting humans and started trusting GitHub Actions. If you want to keep your codebase stable, your repository needs a bouncer. Here is the exact anatomy of the pr-check.yml workflow I write to automate testing on every single pull request: 🎯 1. The Interceptor (on: pull_request): This workflow sleeps until someone tries to merge code into the main branch. The moment a PR is opened, the Action wakes up and intercepts the code before it can do any damage. ☕ 2. The Backend Validator (actions/setup-java): It spins up a fresh Ubuntu container, installs the exact version of Java my Spring Boot app needs, and automatically runs my JUnit test suite. If my new payment logic accidentally breaks an existing booking test, the Action fails, and the PR turns a glaring, angry red. 🔴 ⚛️ 3. The Frontend Sibling (actions/setup-node): Because I'm running a full-stack repo, I run a parallel job for React. It installs Node.js, runs npm ci, and executes the frontend tests. It guarantees that the UI components are perfectly in sync with the backend changes. 🔒 4. The Ultimate Safety Net (Branch Protection): Writing the script isn't enough. I go into the GitHub repository settings and activate "Require status checks to pass before merging." This is the real magic. Even as the repo owner, I physically cannot click the green "Merge" button until the GitHub Action finishes running and passes every single test. Stop wasting your code review time checking for broken tests or syntax errors. Let the robots do the grunt work so you can focus on reviewing the actual architecture. What is your favorite CI/CD tool right now? Are you writing GitHub Actions, or are you on GitLab CI / Bitbucket Pipelines? Let’s chat below! 👇 Follow RAHUL VIJAYAN for more. #GitHubActions #DevOps #CICD #SpringBoot #ReactJS #BackendEngineering #SoftwareDevelopment #TechCareers
To view or add a comment, sign in
-
-
Ideas bubble and GitHub issues pile up faster than I can work them. So, I built a shell script that spins up an isolated Claude session per issue: fresh worktree, dev server, and a SpecKit lifecycle that pauses for my spec approval before writing any code. Three headless runs in the morning. Three spec reviews at lunch. Three open PRs by evening. The bottleneck moved from typing to review, which is exactly where I want my time to go. Full write-up with the GitOps loop diagram: https://lnkd.in/gdpxEUpE #ClaudeCode #GitOps #SpecDrivenDevelopment #AIEngineering #DeveloperProductivity
To view or add a comment, sign in
-
GitHub Actions Simplified: Breaking Down a CI/CD Pipeline 🚀 Ever felt like YAML files were written in a secret language? If you're looking to automate your workflow, GitHub Actions is the powerhouse you need to master. This visual guide breaks down a standard Java/Maven CI/CD pipeline into bite-sized pieces. Here is the core logic of what’s happening: 1. The Trigger (on:) Everything starts with an event. In this example, the pipeline wakes up whenever someone pushes code or opens a pull request to the main branch. No manual intervention required! 2. The Build & Test Job Before code goes live, it needs to be validated. • Environment: It runs on ubuntu-latest. • Steps: It checks out your code, sets up the Java environment (JDK 11), builds the app with Maven, and runs automated tests. If a test fails here, the process stops—saving you from breaking production. 3. The Deployment Job (needs: build) This is the "CD" part of CI/CD. Notice the needs: build tag? This creates a dependency, ensuring deployment only happens if the build and tests were successful. • It packages the app into a Docker image. • It uses docker-compose to refresh the running services. 4. Notifications Once the heavy lifting is done, the pipeline sends an automated email to the team. Success is confirmed, and everyone stays in the loop without checking logs. The Bottom Line: Automation isn't just about saving time; it’s about creating a repeatable, reliable process that catches bugs early and deploys with confidence. What’s your favorite GitHub Action trick or marketplace plugin? Let’s chat in the comments! 👇 #GitHubActions #CICD #DevOps #SoftwareEngineering #Automation #CodingTips #TechCommunity
To view or add a comment, sign in
-
-
Hi all 👋 🔹 What is Gerrit Code Review? 🧠 Logic first: In real-world development, many engineers push code → someone must review, approve, and ensure quality before merging. 👉 Gerrit sits between developer and main codebase to enforce this review process. 📌 Definition: Gerrit is a web-based code review tool for Git repositories that helps teams: ✔️ Review code changes before merging 💬 Track discussions on each line of code 🔐 Control who can approve/reject changes --- 🔹 How Gerrit Works (Simple Flow) 1️⃣ Developer writes code 👨💻 2️⃣ Pushes code to Gerrit (not directly to main branch) ⬆️ 3️⃣ Reviewers check: 🔍 Code quality 🐞 Bugs 🧩 Logic 4️⃣ Reviewers give: ✅ +1 / +2 (approve) ❌ -1 / -2 (reject) 5️⃣ After approval → code gets merged 🔄✅ --- 🔹 Real-Time Example (Networking Project – Your Domain) 🌐 Imagine you're working on XYZ Switch firmware (like 1234 series): 📌 Scenario: You fix a DHCP Snooping bug ❌ Without Gerrit: You push directly → bug might break production 😬💥 ✅ With Gerrit: You push patch to Gerrit 📤 👨🔧 Senior reviews: ✔️ Checks packet flow logic ✔️ Verifies security impact 🔐 💬 Reviewer comments: > "Handle edge case when DHCP OFFER is malformed" 🔁 You update code → push new patchset ✅ Once approved → merged safely 👉 Result: No production outage 🚫🔥 + better code quality 📈 --- 🔹 Why Companies Use Gerrit (A,B,C...etc.) 🏢 Strict code quality control 🧾 Traceability (who changed what & why) 🔐 Strong access control ⚙️ Ideal for large-scale systems (networking, embedded, OS) --- 🚀 In large-scale software development, pushing code directly to the main branch can be risky. That’s where Gerrit Code Review comes in. 🔹 How it works: 1️⃣ Developer pushes code to Gerrit 2️⃣ Reviewers analyze logic, performance, and edge cases 3️⃣ Feedback is given (+1 / -1, comments) 4️⃣ Code is refined and approved 5️⃣ Finally merged into the main branch ✅ 💡 Key takeaway: Gerrit is not just a tool — it's a quality gate that makes large systems stable and production-ready. --- #Gerrit #CodeReview #Networking #EmbeddedSystems #SoftwareEngineering #Git 🚀
To view or add a comment, sign in
-
-
🚀 From side project to a full Git desktop client About a week ago I shared that I was building a Git UI tool in my spare time. What started as a small experiment has turned into something much bigger than I expected. After years of using Git every day, switching between terminals and various GUI tools, I had a clear picture of what I wanted: a single place where I could see everything, do everything, and never feel limited. So I kept building. Feature after feature, evening after evening. Today the app includes pretty much everything I've needed over the years: 📊 A commit graph that actually helps you understand what's going on, with branch filtering, author filtering, and commit search 🔀 Full merge, rebase and cherry pick workflows with conflict detection and resolution built in 📝 A commit dialog inspired by the best tools out there, with staging controls, templates, and conventional commits support 🧠 AI integration (Anthropic, OpenAI, Gemini) to generate meaningful commit messages, resolve merge conflicts, write PR descriptions, and even review code 🔧 An embedded terminal, external editor integration, multi account Git identity management, and 50+ Git operations exposed via MCP for AI assistants 📈 Author statistics, codebase analytics, changelog generation, and much more The principle behind every feature is the same: with a single glance, understand the state of a repository and take action immediately. Worth mentioning is the AI layer. If you've ever stared at a merge conflict wondering which side to pick, or spent too long crafting a commit message, having an AI assistant that understands your repo context makes a real difference in your daily workflow. If you want to try the AI features without any cost, Gemini's free tier should be more than enough to handle typical Git interactions. The app is cross platform (Windows, Linux, macOS), open source, and built with Electron, React, and TypeScript. It's now my daily driver for everything Git related, and I hope it can be useful to you too. Check it out here 👉 https://lnkd.in/dzbUEmJ6 I'd love feedback from anyone who lives in Git every day like I do. #Git #DeveloperTools #SideProject #Electron #OpenSource #AI
To view or add a comment, sign in
-
𝗜 𝘁𝗵𝗼𝘂𝗴𝗵𝘁 𝗜 𝗸𝗻𝗲𝘄 𝗚𝗶𝘁... 𝘂𝗻𝘁𝗶𝗹 𝗜 𝗵𝗮𝗱 𝘁𝗼 𝗱𝗼 𝘁𝗵𝗶𝘀. Recently I ran into a pretty unusual scenario: • move an entire sprint between different repositories • keep the commit history intact • adapt commit message conventions along the way But there was a real constraint: 𝘁𝗵𝗲 𝗽𝗿𝗼𝗷𝗲𝗰𝘁𝘀 𝗵𝗮𝗱 𝗱𝗶𝗳𝗳𝗲𝗿𝗲𝗻𝘁 𝗶𝗻𝗳𝗿𝗮𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲 (𝘀𝗲𝗿𝘃𝗲𝗿 𝗰𝗼𝗻𝗳𝗶𝗴𝘀, 𝗗𝗼𝗰𝗸𝗲𝗿, 𝗽𝗶𝗽𝗲𝗹𝗶𝗻𝗲𝘀...) So copying code wasn’t an option. That’s when I used a lesser-known approach: 𝗽𝗮𝘁𝗰𝗵𝗲𝘀 + 𝘄𝗼𝗿𝗸𝘁𝗿𝗲𝗲𝘀 𝘁𝗼 𝗺𝗼𝘃𝗲 𝗱𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁 𝗮𝗰𝗿𝗼𝘀𝘀 𝗰𝗼𝗻𝘁𝗲𝘅𝘁𝘀 The flow looked like this: 1. Develop normally in a worktree 2. Export commits using `git format-patch` 3. Adjust the patches 4. 𝗥𝗲𝗺𝗼𝘃𝗲 𝗰𝗼𝗺𝗺𝗶𝘁𝘀 𝘁𝗵𝗮𝘁 𝗱𝗶𝗱𝗻’𝘁 𝗯𝗲𝗹𝗼𝗻𝗴 𝗶𝗻 𝘁𝗵𝗲 𝘁𝗮𝗿𝗴𝗲𝘁 (𝗲.𝗴. 𝗶𝗻𝗳𝗿𝗮 𝗰𝗼𝗻𝗳𝗶𝗴𝘀) 5. Prepare the correct base on the destination 6. Reapply everything with `git am --3way` Sounds simple… but then reality hit: - commit conventions were different between the projects So I did what any dev would do… 𝗜 𝗮𝘂𝘁𝗼𝗺𝗮𝘁𝗲𝗱 𝗶𝘁 I built a shell script that: • reads a YAML mapping file (from → to) • renames patches automatically • asks for input when no mapping is found • allows 𝘀𝗸𝗶𝗽 or even 𝗮𝗯𝗼𝗿𝘁 𝗮𝗹𝗹 mid-process Result: - repeatable process - fewer manual errors - full control over history And that’s when it clicked: Git is not just version control it’s a tool for 𝘁𝗿𝗮𝗻𝘀𝗳𝗼𝗿𝗺𝗶𝗻𝗴 𝗮𝗻𝗱 𝘁𝗿𝗮𝗻𝘀𝗽𝗼𝗿𝘁𝗶𝗻𝗴 𝗵𝗶𝘀𝘁𝗼𝗿𝘆 You don’t need to copy code. You can 𝗿𝗲𝗯𝘂𝗶𝗹𝗱 𝘁𝗵𝗲 𝘀𝘁𝗼𝗿𝘆 𝘁𝗵𝗲 𝗿𝗶𝗴𝗵𝘁 𝘄𝗮𝘆 𝗼𝗻 𝘁𝗵𝗲 𝗼𝘁𝗵𝗲𝗿 𝘀𝗶𝗱𝗲. And that opens up a whole new set of possibilities. Curious: - have you ever automated a “weird” Git workflow like this? #git #softwareengineering #backend #devlife #programming #developer #tech #coding #automation #devops #softwaredevelopment #engineering
To view or add a comment, sign in
-
-
🚀 Watch what happens after a developer writes code… 👨💻 Code → git commit ⚡ Pre-commit checks run instantly (lint, tests, types) 🔁 Code moves to repository 🤖 Automated workflow triggers 🧪 Runs validation again (team-level checks) 🏗️ Builds the application 🚀 Deploys to staging → quick verification 🌍 Then safely released to production 💡 In just a few seconds, you’re seeing: Code → Check → Build → Deploy 🧠 This is how modern development ensures: ✔ Clean code ✔ Safe releases ✔ Zero manual steps #SoftwareEngineering #Developers #Automation #CleanCode #JavaScript
To view or add a comment, sign in
-
What actually happens between git push and your app going live in production? Most engineers know CI/CD as a concept. Very few know exactly what fires, when, and why. Here is the complete flow — step by step: STEP 1 — Code commit Developer pushes to a feature branch. A webhook fires immediately. Your pipeline wakes up. STEP 2 — Build Source code is compiled. Dependencies are resolved. If this fails, nothing else runs. STEP 3 — Unit tests Every test in your codebase runs automatically. One failure stops the pipeline cold. No exceptions. STEP 4 — Static code analysis (SAST) SonarQube scans for bugs, vulnerabilities, and code smells. A quality gate defines what passes. STEP 5 — Docker image build The application and all its dependencies are packaged into an immutable container image. Tagged with the commit SHA. STEP 6 — Image push to registry The image is pushed to ECR or DockerHub. This is the artifact that will be deployed everywhere. STEP 7 — Deploy to staging The new image is automatically deployed to a staging Kubernetes cluster. No manual steps. STEP 8 — Integration tests Tests run against the live staging environment. Real HTTP calls, real database, real assertions. STEP 9 — Approval gate A human reviews and approves. One click. STEP 10 — Production deploy ArgoCD detects the approved image tag in Git and deploys to production. Zero downtime rolling update. Total time: 8–15 minutes. Manual process equivalent: 2–3 hours. #DevOps #CICD #Jenkins #Kubernetes #Automation #SoftwareEngineering #CloudEngineering
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