Git by itself will happily let you commit: ▪️ Ugly formatting ▪️ Failing code ▪️ Secrets ▪️ Broken configs It doesn't assess quality; it just stores snapshots, which is why automation is vital within teams to catch problems early. There are 3 Key Layers: 1️⃣ .gitignore Your first line of defence, it prevents you from tracking sensitive information by telling Git what not to track: ▪️.env files (secrets) ▪️Dependencies ▪️Logs ▪️System Files If set up properly, a lot of problems can be prevented. 2️⃣ Pre-commit hooks A hook is a script that git will run automatically at select points in the git workflow. One of the points is before a commit is created... If it passes these checks, the commit will go through If it fails, the commit will be blocked These checks include: ▪️Linters (code quality) ▪️Tests (does it still work?) ▪️Secret scanning This layer stops bad code before it enters your repo history. But its not perfect and must not be solely relied on. 3️⃣ CI - Continuous Integration This set of checks runs after you push your code CI will: ▪️Run tests ▪️Check formatting ▪️Scan for secrets ▪️Build the project If something fails, your PR will be blocked. The issue here is that it runs after the commit already exists, so the secret is already in history, but the PR won't be merged; warnings will show, and the team will be notified. All 3 are needed to ensure that rules are consistent, checks are automatic, and fewer mistakes reach PRs or the main. If all is well, then the PR will be approved. A Pull Request isn't just a click merge button... It acts as a checkpoint: ▪️Reviews the code ▪️Catches mistakes ▪️Enforces standards A proper workflow: ( *simplified) *Feature Branch ➡️ PR ➡️ Review ➡️ Merge Git doesn't protect you - these layers and check do. #Git #CoderCo #DevOps
Git Workflow Layers for Secure Code Committing
More Relevant Posts
-
"Why is this line like this?" Nobody on the team knew. The code did. 🔥 Happy Git Friday! Code review. Someone flagged a line in a config file that looked wrong. Not broken, just odd. A hardcoded value where a variable should have been. Nobody on the team remembered writing it. Nobody remembered approving it. It had been there so long it was just part of the landscape. Instead of guessing, I ran: git blame config.yml Every line in the file came back annotated with the commit hash, the author, and the date. That odd line? It was a workaround from two years ago. A specific bug in a dependency required a hardcoded value to avoid a crash. The bug was patched six months later. The workaround was never removed. No comment. No ticket reference. Just a line that made no sense anymore because the context was gone. git blame didn't just tell me who wrote it. It told me when, which commit, and gave me enough context to pull up the original PR and understand why. Two minutes of blame saved an hour of guessing and a potential rollback of something that turned out to be safe to remove. The Danger Zone (When Nobody Remembers Why): 🔹 Uncommented workarounds become mysteries the moment the original author leaves or forgets. git blame is the only way to recover the context when the code doesn't explain itself. 🔹 git log shows you commit history for the whole file. git blame shows you commit history per line. When you need to know why one specific line exists, log is too broad. Blame is surgical. 🔹 Removing a line you don't understand is risky. Blame gives you the commit, the commit gives you the PR, the PR gives you the discussion. That's the chain of context that makes the decision safe. ❓ Question of the Day: Which command shows who modified each line of a file and in which commit? Ⓐ git blame filename Ⓑ git who filename Ⓒ git log filename Ⓓ git diff filename 👇 Answer and breakdown in the comments! #Git #GitOps #DevOps #DamnitRay #QOTD
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
-
-
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
-
-
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
-
-
💡 Git Tip: Cherry-Pick – Copy Only What You Need! In real-world projects (especially in automation & CI/CD pipelines), we often face situations like: 👉 A code fix is done in one branch, but urgently needed in another 👉 You don’t want to merge the entire branch (to avoid unwanted changes) 👉 You just need that one specific commit That’s where cherry-pick becomes a lifesaver. 🔧 What it does: It allows you to pick a specific commit from one branch and apply it to another branch. 🧠 Basic usage: git checkout target-branch git cherry-pick <commit-hash> 🚀 Why it’s powerful: ✔ Avoids unnecessary merges ✔ Helps in hotfix scenarios ✔ Keeps branches clean and controlled ✔ Saves time during production fixes ⚠️ Be careful: Cherry-picking creates a new commit → so overusing it can make history messy if not handled properly. 💭 In automation projects, this is super useful when a small fix in test scripts or pipeline config needs to be quickly applied across branches without disturbing ongoing work. #Git #VersionControl #AutomationTesting #SDET #DevOps #SoftwareTesting #Learning
To view or add a comment, sign in
-
Git Series | Day 8: Mastering Git Rebase — The Professional Standard for Clean History 🛠️✨ Integration is easy; maintaining a clean, readable history is hard. Today I moved beyond the standard 3-way merge to master Git Rebase, the tool that allows DevOps teams to keep their project timelines linear and manageable. 1. The Problem: The "Mixed" History of 3-Way Merges While a 3-way merge works, it has two major drawbacks in large-scale projects: Extra Commits: Every merge creates a "Merge Commit" which doesn't contain actual code changes, just integration data. Non-Linearity: The commit history becomes a "tangled web" of branches crossing over each other, making it difficult to audit or debug specific features. 2. The Solution: What is Rebase? Rebase is the process of moving or combining a sequence of commits to a new base commit. Instead of "merging" the branches, I am effectively rewriting the history so it looks like the feature branch was started from the most recent commit on the master branch. The Result: A perfectly linear history with no extra merge commits. The Command: While on the feature branch, run < git rebase master > 3. The Rebase Conflict Workflow Conflicts in rebase happen commit-by-commit, giving you granular control. My standardized resolution process is now: Identify: Find the file causing the conflict. Resolve: Edit the file, remove the headers/conflict markers. Stage: git add <file>. Safety Valve: If things go wrong, git rebase --abort brings me back to the pre-rebase state. #Git #DevOps #GitRebase #CleanCode #VersionControl #SoftwareArchitecture #100DaysOfCode #GitWorkflow #EngineeringExcellence
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
-
-
You're still pushing deployments manually. ArgoCD watches your Git repo and does it for you. This is GitOps. And it changes everything. The old way — Push-based CI/CD Jenkins builds your code ✅ Jenkins pushes to Kubernetes ✅ Jenkins needs cluster credentials stored somewhere 😬 Pipeline fails halfway — cluster is in unknown state 💀 Nobody knows what's actually running in prod 🤷 The ArgoCD way — Pull-based GitOps Your Git repo IS the truth. ArgoCD watches your repo 24/7. Repo changes → ArgoCD pulls → deploys automatically. Cluster drifts from Git? ArgoCD self-heals it back. What's in Git = What's in prod. Always. No exceptions. The mental model that sticks: 🏠 Git repo = The architect's blueprint 👷 ArgoCD = The builder who checks the blueprint every 3 minutes 🏗️ Kubernetes = The building If someone adds an unauthorized wall — ArgoCD tears it down and rebuilds from the blueprint. The 3 things ArgoCD gives you: 1. Sync — Desired state (Git) matches Live state (K8s). Always. 2. Self-heal — Someone kubectl applys something manually? ArgoCD reverts it. Git wins. 3. Multi-cluster — One ArgoCD. Manages dev, staging, prod clusters from one dashboard. Real talk for mid-level engineers: Your CI pipeline's job is to build and test. ArgoCD's job is to deploy and maintain. Separation of concerns. Each tool does one thing perfectly.
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