Git Series | Day 9: Optimization & Deployment — Squash, Cherry-Pick, and .gitignore 🚀 As I near the end of this series, I am focusing on the "polishing" tools that professional DevOps Engineers use to ensure their repositories are clean, secure, and ready for production. 1. Squash: Consolidating the Journey Why show 10 "work-in-progress" commits when one clean commit will do? Squash allows me to combine multiple commits into a single, meaningful entry. The Command: git rebase -i HEAD~number The Workflow: In the interactive editor, I keep the first commit as "pick" and change the others to "squash." The Benefit: It keeps the master branch history concise and high-level for senior reviewers. 2. Cherry-Pick: Surgical Precision Sometimes you don't want an entire branch; you just want one specific fix or feature. The Concept: Picking a single commit from one branch and applying it to another. The Command: git cherry-pick <commit-id> The Use Case: Great for pulling a critical hotfix from a development branch directly into production without bringing unfinished features along. 3. .gitignore: The Silent Guardian A professional repository should never contain logs, environment variables, or temporary build files. The Mechanism: By creating a .gitignore file, I tell Git which files to permanently ignore from tracking. Standard Exclusions: I typically exclude *.log, .env (security), and folders like /db or node_modules. The Result: Smaller repository size and zero risk of pushing sensitive credentials to GitHub. 4. Deployment: Hosting via GitHub Pages Git isn't just for tracking; it’s for delivering. I practiced hosting static web applications directly from a repository. Push your code to a new GitHub repository. Navigate to Settings > Pages. Select the master branch and save. Your application is live and accessible via a public URL! My use of .gitignore ensures that sensitive configuration data and "garbage" files never enter the version control system. I Streamline Code Reviews: By squashing messy development commits before merging. #Git #DevOps #100DaysOfCode #WebDeployment #GithubPages #CleanCode #SoftwareEngineering #SysAdmin #GitIgnore
Git Optimization & Deployment Tools for DevOps Engineers
More Relevant Posts
-
Git isn't just a version control tool — it's the starting point of your entire delivery pipeline. Every CI/CD pipeline, every deployment, every infrastructure change begins with a Git event. A push, a merge, a pull request. Here are the Git commands that actually matter in DevOps: The daily basics: → git clone — copy a repo to your local machine → git pull — get the latest changes from remote → git add . — stage all changes → git commit -m " " — save your changes with a message → git push — send your changes to remote Branching: → git branch — list all local branches → git checkout -b name — create and switch to a new branch → git merge branch-name — merge changes from one branch into another Debugging and recovery: → git log --oneline — see commit history in a clean format → git diff — see exactly what changed between states. → git revert <commit> — undo a commit safely without rewriting history → git stash — temporarily save changes you're not ready to commit Status: → git status — Run git status constantly. It tells you exactly where you are, what's staged, what's not, and what branch you're on. It saves so much confusion. Understanding Git properly means understanding how the entire delivery process begins. What Git command do you wish you had learned earlier? 👇 #DevOps #Git #VersionControl #CICD #LearningDevOps #BeginnerDevOps #TechCareers #LearningInPublic
To view or add a comment, sign in
-
-
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
-
-
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
-
🚀 Day 6 of #100DaysOfDevOps Challenge Today I explored one of the most fundamental pillars of modern software development — Version Control Systems (VCS) and Git 🔥 📌 Here’s what I learned today: 🔹 What is Version Control System (VCS)? A system that tracks changes in code over time, enabling collaboration, history tracking, and easy rollback when needed. 🔹 Why is it important? ✔️ Maintains complete history of changes ✔️ Enables team collaboration ✔️ Supports branching & experimentation ✔️ Ensures code safety and integrity 🔹 What is Git & Why Git? Git is a distributed VCS known for its speed, flexibility, and powerful branching capabilities. It’s widely used in DevOps and CI/CD pipelines. 🔹 Git Stages Explained: 📂 Working Directory – Where you create/modify files 📌 Staging Area – Where changes are prepared (git add) 📦 Repository – Where changes are permanently stored (git commit) 🔹 Git Lifecycle: Modify ➝ Stage ➝ Commit ➝ Push ➝ Pull 🔹 Linux Commands to Install Git: sudo apt install git -y sudo yum install git -y sudo dnf install git -y 🔹 Git Logs: Tracking history using commands like: git log git log --oneline git log --graph 💡 Key Takeaway: Mastering Git is not optional — it’s a must-have skill for every DevOps Engineer to manage code efficiently and collaborate seamlessly. 📈 Every commit you make is a step closer to becoming a better engineer! 🔥 What’s next? Diving deeper into branching strategies and Git workflows! #DevOps #100DaysOfDevOps #Git #VersionControl #Linux #CloudComputing #SoftwareDevelopment #DevOpsJourney #LearningInPublic #TechGrowth #CI_CD #Automation #Programming #Developers #flm #Engineering #CareerGrowth #OpenSource #TechCommunity #BuildInPublic 🚀
To view or add a comment, sign in
-
-
🚀 Day 39 – Git Merge Conflicts & Resolution ⚠️🔧 Today I learned about merge conflicts in Git and how to resolve them — an important skill when working in team projects 💻 ⚠️ What is a Merge Conflict? A merge conflict occurs when two changes are made to the same file or line of code in different branches, and Git is unable to automatically merge them. 🔍 When Do Conflicts Happen? Two developers edit the same file Same line is modified in different branches Changes overlap ⚙️ How to Identify Conflict When merging, Git shows: <<<<<<< HEAD Your changes ======= Other branch changes >>>>>>> feature 🛠️ Steps to Resolve Conflict 1️⃣ Open the conflicted file 2️⃣ Identify the conflicting code 3️⃣ Edit and keep the correct version 4️⃣ Remove conflict markers 5️⃣ Add and commit 👉 Commands: git add . git commit -m "resolved conflict" 💡 Best Practices ✔ Pull latest code before starting work ✔ Use small commits ✔ Communicate with team ✔ Avoid editing same file simultaneously 📌 My Learning Today Understanding merge conflicts helped me realize how important collaboration and proper version control are in real-world projects. Resolving conflicts is a key DevOps skill 💪 #Git #MergeConflict #DevOps #VersionControl #CloudComputing #LearningJourney #TechSkills #WomenInTech #CloudEngineer
To view or add a comment, sign in
-
Today I completed a Git/Gitea task that looked simple on paper: Review a pull request, approve it, and merge the story/fox-and-grapes branch into master. Sounds straightforward. But between me and that green tick were the small details that matter in real team workflows. Let me break it down 👇 What the Task Required: Log in as tom. Open the pull request titled Added fox-and-grapes story. Review the changes carefully. Approve the PR. Merge it into master. 🔴 What I Did (and what it means in real life): Checked the repository and confirmed the branch. This was the part where I made sure I was in the right repo and on the right feature branch. In a real team, this prevents you from reviewing the wrong code or merging the wrong work. Opened the pull request and reviewed the story changes. I went through the file diff to verify the content was complete and consistent. In production, this is how teams catch mistakes before they reach the main branch. Approved the pull request. Approval is more than a click, it signals that the change is acceptable and ready to move forward. In a real team, this is how code quality stays intentional, not accidental. Merged the PR into master. This was the final step that actually delivered the work into the main branch. In a live environment, this is the point where a feature becomes part of the product and is ready for everyone else to build on. A pull request is not just a button. It is a workflow that protects the codebase, keeps collaboration clean, and makes sure changes are reviewed before they land. In the lab, I had time to inspect, approve, and merge. In a real team, the same process helps avoid broken releases, miscommunication, and silent errors. This is why we practice. This is why we review carefully. This is why version control is more than Git commands, it is teamwork in action. 💪 Do you get?? #Git #Gitea #PullRequest #CodeReview #DevOps #CloudEngineering #LearningInPublic #WomenInTech
To view or add a comment, sign in
-
-
Git Branching Strategies — What actually matters in real projects When I first started using Git, I thought it was simple: create a branch, push code, and the job is done. But working on real projects changed that perspective. The wrong branching strategy does not just create small issues. It leads to confusion, messy workflows, and problems that become harder to fix over time. Here is a simple understanding of the most commonly used strategies: Feature Branching : Each feature is developed in its own branch and merged back once complete. This keeps work isolated and makes code reviews easier. It is one of the most practical approaches for most teams. Gitflow : A more structured model with dedicated branches such as main, develop, feature, release, and hotfix. It works well for teams that follow strict release cycles and need better version control. GitHub Flow A simpler approach where the main branch is always production-ready. Changes are made in short-lived branches and merged quickly. Ideal for teams practicing continuous deployment. GitLab Flow : Combines feature branching with environment-based workflows like staging and production. It integrates well with CI/CD pipelines and supports continuous delivery. Trunk-Based Development : Developers merge small changes frequently into the main branch. This requires strong discipline and testing practices but enables faster feedback and delivery. One important thing I learned is that there is no single “best” strategy. The right choice depends on your team size, project complexity, release frequency, and deployment process. A common mistake I have seen is teams adopting complex strategies like Gitflow without actually needing that level of structure. For me, feature branching felt like the most natural starting point. It is simple, clear, and effective. What has worked best for your team? #DevOps #Git #GitHub #CICD #VersionControl #SoftwareEngineering #Automation
To view or add a comment, sign in
-
-
Git in Real Life: When I started using Git, I thought it’s just for pushing code. But in real production environments, Git becomes the single source of truth. Let me share a real-world scenario Scenario: Production Issue One day, a critical service started failing after deployment. Everything looked fine in CI/CD, but users were facing errors. First step? Not logs… Git history. Using: git log --oneline We traced a recent commit where a config file was modified. Use Case: Root Cause Analysis We compared changes using: git diff <commit-id> Found that: - Environment variable was changed - API endpoint misconfigured A small change, but huge impact. Fix Strategy Instead of manually fixing, we rolled back safely: git revert <commit-id> git push origin main Production stabilized within minutes Daily Use Cases of Git in DevOps - Managing infrastructure code (Terraform, Kubernetes YAMLs) - Version controlling CI/CD pipelines - Tracking configuration changes - Enabling team collaboration - Supporting GitOps workflows Must-Know Commands (Real Usage) git clone <repo> git checkout -b feature-branch git add . git commit -m "feature update" git push origin feature-branch git pull origin main git merge main Troubleshooting Scenarios 1. Merge Conflict git pull origin main Fix conflicts manually → then: git add . git commit -m "resolved conflict" 2. Wrong Commit Made git reset --soft HEAD~1 3. Lost Changes git stash git stash apply 4. Check Who Changed What git blame <file> Key Learning Git is not just a tool. It’s your safety net, audit system, and collaboration engine. In production, debugging often starts from Git, not from code. Final Thought A single commit can: - Break production - Or save hours of debugging So always: Commit smart. Review carefully. Deploy confidently. #Git #DevOps #Troubleshooting #VersionControl #Cloud #Git Lab #MLOPS #devsecops
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 Series | Day 10: The Workflow Multitasker — Mastering Git Stash & Release Tags 🏷️🚀 As a DevOps Engineer, priorities shift in seconds. Today I learned how to handle emergency context-switching and how to officially mark production milestones using Git’s versioning tools. 1. Git Stash: The "Pause" Button Sometimes you're mid-feature and a critical bug comes in. You can't commit unfinished code, but you can't lose it either. The Concept: Git Stash takes your uncommitted changes (both staged and unstaged) and "hides" them away in a temporary storage area, giving you a clean working directory. Key Commands: git stash -m "message": Save your current progress with a label. git stash list: See all your "paused" work. git stash apply: Bring back the most recent changes but keep the record in the stash list. git stash pop: Restore your work and delete it from the stash simultaneously. git stash drop: Permanently delete a stash if the work is no longer needed. 2. Git Tags: Marking the Milestones In production environments, we don't deploy "commits"; we deploy Versions. Lightweight Tags: A simple pointer to a commit (v1.0, v2.0). Annotated Tags: These are stored as full objects in the Git database. They include the tagger's name, email, date, and a message. This is the Senior DevOps Standard for official releases. Key Commands: git tag -a v1.0 -m "Production Release": Create an annotated tag. git show v1.0: View detailed metadata about the release. git push origin v1.0: Tags must be pushed to the remote server explicitly. git push origin --tags: Push all local version markers to GitHub at once. By using annotated tags, I ensure every production deployment is version-controlled and easily rollable, providing the stability required for enterprise-grade infrastructure. #Git #DevOps #100DaysOfCode #ReleaseManagement #SoftwareEngineering #GitStash #Versioning #SystemAdmin #AgileDevelopment
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