I blocked git push in my repository. Here's why this decision transformed my code quality. As developers, we've all been there: "I'll add tests later" turns into technical debt that compounds over time. CI/CD catches issues, but only after the code is already committed. So I implemented a different approach: direct git push is completely blocked. Instead, all code must go through a controlled mechanism (npm run push) that: → Validates that changed lines have adequate code coverage → Ensures every commit includes appropriate test cases → Enforces quality policies at the commit level, not after the fact The result? Every single commit in my repository meets my quality standards. No exceptions. No "emergency pushes" that bypass the rules. I'm now extracting this pattern into an open source project called HookFlows, making it easy for teams to implement similar guardrails in their own workflows. The best time to catch code quality issues isn't in code review or CI - it's before the commit even happens. What guardrails do you have in place to enforce code quality? #SoftwareEngineering #DevOps #CodeQuality
More Relevant Posts
-
🕵️ #BlameGame – 𝐆𝐢𝐭 𝐍𝐞𝐯𝐞𝐫 𝐅𝐨𝐫𝐠𝐞𝐭𝐬 ✨ Something broke in production?? Everyone asks: “𝑊ℎ𝑜 𝑤𝑟𝑜𝑡𝑒 𝑡ℎ𝑖𝑠 𝑐𝑜𝑑𝑒?” 🤨 Git has the answer: 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 𝗳𝗶𝗹𝗲.𝘁𝘅𝘁 It shows: ✅ Who wrote each line ✅ When it was written ✅ Which commit introduced it Git basically says: “𝑰 𝒌𝒆𝒑𝒕 𝒓𝒆𝒄𝒆𝒊𝒑𝒕𝒔. 𝑨𝒍𝒍 𝒐𝒇 𝒕𝒉𝒆𝒎.” 🧾 No hiding. No guessing. Just… truth 🔍 Git literally exposes: “𝑇ℎ𝑒 𝑔𝑢𝑖𝑙𝑡𝑦 𝑑𝑒𝑣𝑒𝑙𝑜𝑝𝑒𝑟.” (…which might be you from 6 months ago 😅) A good reminder that every line you write 𝒘𝒊𝒍𝒍 𝒄𝒐𝒎𝒆 𝒃𝒂𝒄𝒌 𝒔𝒐𝒎𝒆𝒅𝒂𝒚. 💣𝐏𝐫𝐨 𝐭𝐢𝐩: Use blame smartly - not to blame people, but to understand context. Example: 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 -𝗟 10,20 𝗳𝗶𝗹𝗲.𝘁𝘅𝘁 👉 Shows who modified specific lines (10–20) 💡 𝐄𝐱𝐩𝐞𝐫𝐭 𝐓𝐢𝐩𝐬: 🔹 𝐈𝐠𝐧𝐨𝐫𝐞 𝐰𝐡𝐢𝐭𝐞𝐬𝐩𝐚𝐜𝐞 𝐧𝐨𝐢𝐬𝐞: Sometimes a line is “claimed” just because of formatting changes. 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 -𝘄 𝗳𝗶𝗹𝗲.𝘁𝘅𝘁 👉 Ignores spacing/indentation changes and finds the real author 🔹 𝐃𝐞𝐭𝐞𝐜𝐭 𝐜𝐨𝐩𝐢𝐞𝐝/𝐦𝐨𝐯𝐞𝐝 𝐜𝐨𝐝𝐞: When code is moved between files, it may credit the person who moved it rather than the one who originally wrote it. 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 -𝗖 𝗳𝗶𝗹𝗲.𝘁𝘅𝘁 👉 Detects lines copied from other files within the same commit ⚡ 𝐏𝐫𝐨-𝐏𝐫𝐨 𝐓𝐢𝐩𝐬: 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 -𝗖𝗖 👉 Detects code copied from other files across any commit in history 𝗴𝗶𝘁 𝗯𝗹𝗮𝗺𝗲 -𝗖𝗖𝗖 👉 Tracks code copied from files that were modified across commits (deepest level of origin tracking) Because debugging is easier when you know the story behind the code 📖 𝑮𝒊𝒕 𝒏𝒆𝒗𝒆𝒓 𝒇𝒐𝒓𝒈𝒆𝒕𝒔. 🧾 #Git #DevOps #Debugging #TechHumor #Developers #FactFriday
To view or add a comment, sign in
-
🚀 𝐃𝐚𝐲 36 — 𝐇𝐨𝐰 𝐆𝐢𝐭 𝐓𝐫𝐚𝐜𝐤𝐬 𝐂𝐡𝐚𝐧𝐠𝐞𝐬 Today I explored how Git actually tracks changes. Most people think Git stores file differences. But the reality is different. Git works using snapshots. Every time you commit code, Git saves a snapshot of the entire project at that moment. Each commit contains: • Author name • Timestamp • Commit message • Unique commit ID (SHA-1 hash) • Snapshot of the project files Example: Commit A → Initial project Commit B → Added login feature Commit C → Fixed login bug Each commit represents a complete version of the project. Why this is powerful: ✔ Easy rollback to previous versions ✔ Clear history of changes ✔ Trace which developer introduced which change This design is one reason why Git is extremely fast and reliable. Tomorrow I’ll explain Git architecture: Working Directory, Staging Area, and Repository. #Git #DevOps #SoftwareEngineering #EngineeringJourney #100DaysOfLearning #BackendEngineering #SystemDesign #LearningInPublic #SoftwareEngineering #TechGrowth #DeveloperJourney #100DaysOfLearning
To view or add a comment, sign in
-
-
This morning I said I prefer merge. This afternoon I'm going to tell you why. 🔥 I once rebased a feature branch onto main and hit a conflict on every single replayed commit. The same file, over and over, because the rebase was replaying each commit individually against a main that had diverged significantly. By the fifth resolution I wasn't even reading the diff anymore. I was just picking sides and hoping. That's not engineering. That's gambling with your codebase. I aborted, ran git reflog to confirm I could recover, and did a merge instead. One conflict. One resolution. Done. Git Recovery Cheat Sheet: ✔️ Mid-Rebase Escape: git rebase --abort (returns your branch to the exact state before the rebase started) ✔️ Already Finished a Bad Rebase: git reflog then git reset --hard HEAD@{n} (find the pre-rebase entry in reflog and reset to it) ✔️ Undo a Merge (Before Pushing): git reset --hard HEAD~1 (removes the merge commit, only safe if you haven't pushed) ✔️ Undo a Merge (Already Pushed): git revert -m 1 <merge_commit_hash> (creates a reversal commit, safe for shared branches) ⚠️ git reset --hard is destructive. It discards uncommitted work. Run git stash first if you have unsaved changes. Never use it on a branch others have pulled. 🔍 Before you run any destructive Git command, run git reflog first. Confirm you can see where you were. That's your safety net. 💾 Save this. You won't need it until you do, and when you do, you'll need it fast. #Git #GitOps #DevOps #DamnitRay
To view or add a comment, sign in
-
My PR got rejected and the code was fine. The commit author was wrong. 🔥 Happy Git Friday! Back in my early git days, when I was working in a lesser controlled environment, I pushed a PR to a work repo and CI flagged it before a human even looked at it. The code passed every test. The linting was clean. The branch was up to date. But the pipeline rejected it because the commit was authored by my personal email, not my corporate identity. I had my global git config set to my personal email. The work repo didn't have a local override. So every commit I made in that repo went out under the wrong identity. I didn't notice because git doesn't warn you. It just uses whatever config it resolves, silently, and moves on. One git config --local user.email fixed it. But the commits already pushed were stamped with the wrong author. Rewriting them meant a force push on a shared branch. Which meant telling the team. Which meant explaining why my personal email was in the commit history of a corporate repo. All because I never set the local config when I cloned the repo. The Danger Zone (When Git Uses the Wrong Identity): 🔹 Git resolves your identity from config without ever asking if it's correct. If global is set and local isn't, global wins. No prompt. No warning. No confirmation. 🔹 Commits pushed under the wrong identity are permanent in the history unless you rewrite them. On a shared branch, that means force-pushing, which affects everyone who has pulled. 🔹 In regulated or audited environments, commit authorship matters. A commit attributed to an unrecognized email can trigger compliance flags, break CI gates, or raise questions during code review. ❓ Question of the Day: How do you configure your global username for Git? A. git config --global user.name "My Name" B. git setup --user "My Name" C. git user --set "My Name" D. git init --user "My Name" 👇 Answer and breakdown in the comments! #Git #GitOps #DevOps #DamnitRay #QOTD #WayBackWhen
To view or add a comment, sign in
-
-
𝗚𝗶𝘁 - 𝗧𝗵𝗲 𝗱𝗮𝗶𝗹𝘆 𝗧𝗶𝗽 As we all know git is one the most powerful tool we have, here are some tips to "optimize" your daily work 𝙗𝙧𝙖𝙣𝙘𝙝.𝙨𝙤𝙧𝙩 -𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 What 𝚋𝚛𝚊𝚗𝚌𝚑.𝚜𝚘𝚛𝚝 -𝚌𝚘𝚖𝚖𝚒𝚝𝚝𝚎𝚛𝚍𝚊𝚝𝚎 Does When you set this configuration, any command that lists branches (like 𝚐𝚒𝚝 𝚋𝚛𝚊𝚗𝚌𝚑) will sort them based on the 𝗱𝗮𝘁𝗲 𝗼𝗳 𝘁𝗵𝗲 𝗹𝗮𝘀𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 made to that branch. 𝗦𝘁𝗮𝗻𝗱𝗮𝗿𝗱 𝗯𝗲𝗵𝗮𝘃𝗶𝗼𝗿: • Branches are listed A-Z. 𝗪𝗶𝘁𝗵 𝘁𝗵𝗶𝘀 𝘀𝗲𝘁𝘁𝗶𝗻𝗴: • The branches with the most recent activity appear at the bottom of the list (closest to your prompt), making them much easier to find in a repository with dozens of stale branches. 𝗣𝗿𝗼-𝗧𝗶𝗽: Adding More Detail • If you want an even more powerful view of your recent work, you can create a "𝘀𝘂𝗽𝗲𝗿 𝗮𝗹𝗶𝗮𝘀" that shows the date and the last commit message: • Set alias 𝙜𝙞𝙩 𝙘𝙤𝙣𝙛𝙞𝙜 --𝙜𝙡𝙤𝙗𝙖𝙡 𝙖𝙡𝙞𝙖𝙨.𝙧𝙡 "𝙗𝙧𝙖𝙣𝙘𝙝 --𝙨𝙤𝙧𝙩=-𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 --𝙛𝙤𝙧𝙢𝙖𝙩='%(𝙖𝙪𝙩𝙝𝙤𝙧𝙙𝙖𝙩𝙚:𝙧𝙚𝙡𝙖𝙩𝙞𝙫𝙚)%𝟬𝟵%(𝙧𝙚𝙛𝙣𝙖𝙢𝙚:𝙨𝙝𝙤𝙧𝙩)%𝟬𝟵%(𝙨𝙪𝙗𝙟𝙚𝙘𝙩)'" You just created a powerful new Git alias named 𝚛𝚕 (Recent List). 𝗨𝘀𝗮𝗴𝗲: 𝗴𝗶𝘁 𝗿𝗹 Enjoy.... #GIt #DevOps
To view or add a comment, sign in
-
-
This is a very useful tip. Especially when working in a team with many branches and many commits. You can set it up to immediately see what branch was most recently used, when was the most recent commit, what was it, and maybe even add the person who committed.
𝗚𝗶𝘁 - 𝗧𝗵𝗲 𝗱𝗮𝗶𝗹𝘆 𝗧𝗶𝗽 As we all know git is one the most powerful tool we have, here are some tips to "optimize" your daily work 𝙗𝙧𝙖𝙣𝙘𝙝.𝙨𝙤𝙧𝙩 -𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 What 𝚋𝚛𝚊𝚗𝚌𝚑.𝚜𝚘𝚛𝚝 -𝚌𝚘𝚖𝚖𝚒𝚝𝚝𝚎𝚛𝚍𝚊𝚝𝚎 Does When you set this configuration, any command that lists branches (like 𝚐𝚒𝚝 𝚋𝚛𝚊𝚗𝚌𝚑) will sort them based on the 𝗱𝗮𝘁𝗲 𝗼𝗳 𝘁𝗵𝗲 𝗹𝗮𝘀𝘁 𝗰𝗼𝗺𝗺𝗶𝘁 made to that branch. 𝗦𝘁𝗮𝗻𝗱𝗮𝗿𝗱 𝗯𝗲𝗵𝗮𝘃𝗶𝗼𝗿: • Branches are listed A-Z. 𝗪𝗶𝘁𝗵 𝘁𝗵𝗶𝘀 𝘀𝗲𝘁𝘁𝗶𝗻𝗴: • The branches with the most recent activity appear at the bottom of the list (closest to your prompt), making them much easier to find in a repository with dozens of stale branches. 𝗣𝗿𝗼-𝗧𝗶𝗽: Adding More Detail • If you want an even more powerful view of your recent work, you can create a "𝘀𝘂𝗽𝗲𝗿 𝗮𝗹𝗶𝗮𝘀" that shows the date and the last commit message: • Set alias 𝙜𝙞𝙩 𝙘𝙤𝙣𝙛𝙞𝙜 --𝙜𝙡𝙤𝙗𝙖𝙡 𝙖𝙡𝙞𝙖𝙨.𝙧𝙡 "𝙗𝙧𝙖𝙣𝙘𝙝 --𝙨𝙤𝙧𝙩=-𝙘𝙤𝙢𝙢𝙞𝙩𝙩𝙚𝙧𝙙𝙖𝙩𝙚 --𝙛𝙤𝙧𝙢𝙖𝙩='%(𝙖𝙪𝙩𝙝𝙤𝙧𝙙𝙖𝙩𝙚:𝙧𝙚𝙡𝙖𝙩𝙞𝙫𝙚)%𝟬𝟵%(𝙧𝙚𝙛𝙣𝙖𝙢𝙚:𝙨𝙝𝙤𝙧𝙩)%𝟬𝟵%(𝙨𝙪𝙗𝙟𝙚𝙘𝙩)'" You just created a powerful new Git alias named 𝚛𝚕 (Recent List). 𝗨𝘀𝗮𝗴𝗲: 𝗴𝗶𝘁 𝗿𝗹 Enjoy.... #GIt #DevOps
To view or add a comment, sign in
-
-
Writing code is the easy part. Managing it at scale is where most engineers fail. Initially, I used Git as a "Save" button. But as my data pipelines grew, I realized that "saving" isn't enough. In a high-stakes environment, you aren't just writing scripts. You are managing a living system. When you're building real-world infrastructure: ↳ Multiple features have to move in parallel without colliding. ↳ Code changes fast, and bugs love to hide in the noise. ↳ You need a clear audit trail of why every decision was made. Without a rigorous version control strategy, you aren't building; you're just gambling. While architecting my latest pipelines, I shifted my focus from "writing code" to "managing evolution." Here is how I’ve leveled up my workflow to ensure stability: ↳ Professional Commit Standards 📝 No more "fixed bug" or "minor update." Every commit is a clear, structured record. I’m building a documentation trail that any Senior can read and trust. ↳ Isolated Feature Branching 🌿 main is sacred. Every new feature lives in its own sandbox. This keeps the core pipeline stable while allowing for high-velocity experimentation. ↳ Refactoring with Zero Fear 🛠️ I don’t just "patch" messy code. I refactor it. Because I trust my Git history, I have the leverage to clean up technical debt, knowing I can roll back in seconds if needed. ↳ The "Decision Timeline" ⏳ My Git graph isn't just a bunch of lines. It’s a strategic timeline of how the system evolved. It’s the difference between a "black box" and a transparent, scalable product. In the real world, code is never static. It’s either evolving or it's rotting. Git isn't just a tool for saving files. It’s the leverage that allows a team to move fast without breaking things. I’m no longer just writing scripts; I’m building the systems that keep them running. #Git #DataEngineering #SystemsArchitecture #CleanCode #VersionControl #SoftwareEngineering #AnalyticsEngineering
To view or add a comment, sign in
-
-
Ever had bugs appear in your codebase from absolutely nowhere? 👀 A developer recently built “Git Shitstorm” — a Go tool that aliases your git command to silently inject random code changes into your repo, 10% of the time. Here’s what makes it devilishly clever: → It pulls real code from your own repo (same file type, real authors, real commit messages) → The changes look completely legitimate in git history → Added latency? Just 15–80ms — completely undetectable → And every time you use git to debug the problem… you might be making it worse The real genius isn’t the code injection. It’s the psychological trap. When debugging mysteriously appearing changes, who checks if git itself has been compromised? Nobody. Because git appears to work fine. This is a masterclass in how trust assumptions create blind spots in debugging. As engineers, we’re trained to question our code, our logic, our dependencies — but rarely the tools themselves. The lesson here isn’t “watch out for pranks.” It’s this: When something feels impossible to debug, question your most fundamental assumptions first. Source: https://lnkd.in/dhqXw3MD (And maybe audit your .bashrc occasionally 😅)
To view or add a comment, sign in
-
-
We usually think about software quality in terms of code, tests, and architecture. But Git history matters too. Clear commits make a codebase easier to understand, maintain, and improve over time, especially when AI is used extensively. Nice read on why Git history is more important than it gets credit for: https://lnkd.in/d5iVYEQy
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
- Code Quality Best Practices for Software Engineers
- Improving Software Quality Through Code Review
- How to Maintain Code Quality in AI Development
- Maintaining Code Quality Through Regular Reviews
- Simple Ways To Improve Code Quality
- GitHub Code Review Workflow Best Practices
- How to Improve Your Code Review Process
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