𝗚𝗶𝘁 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴 𝗦𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀 𝘀𝗼𝗺𝗲𝘁𝗵𝗶𝗻𝗴 𝗜 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗼𝗼𝗱 𝗼𝗻𝗹𝘆 𝗿𝗲𝗰𝗲𝗻𝘁𝗹𝘆 When I started using Git, I honestly thought branching simply means "create branch, push code, done." That's it. Job over. But while working on actual projects, one thing hit me hard. The wrong branching strategy does not just cause small hiccups. It creates confusion that keeps piling up and becomes very difficult to manage later. So let me share what I understood, in simple words. 𝗠𝗮𝗶𝗻 𝗼𝗿 𝗧𝗿𝘂𝗻𝗸-𝗕𝗮𝘀𝗲𝗱 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁: Everyone commits directly to one main branch with small, frequent updates. Simple to follow, but it needs a lot of discipline from every single person on the team. 𝗙𝗲𝗮𝘁𝘂𝗿𝗲 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴: Every feature gets its own separate branch. Once the work is done, it gets merged back to main. Very easy to manage and track, and honestly the most commonly used approach in most teams I have seen. 𝗚𝗶𝘁 𝗙𝗹𝗼𝘄: This one has dedicated branches for everything, main, develop, feature, release, hotfix. Slightly more process-heavy but very useful once your project or team starts growing. 𝗥𝗲𝗹𝗲𝗮𝘀𝗲 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴: A separate branch is created for each release and all bug fixes are handled there before anything goes live. Very helpful when you want stable and controlled deployments. One thing I genuinely realised after all this is that there is no perfect branching strategy that works for everyone. It completely depends on your team size, your project, and how frequently you are shipping things. Personally, feature branching felt like the most natural starting point for me and I still use it quite often. #DevOps #Git #GitHub #CICD #VersionControl #CloudComputing #Docker #Kubernetes #AWS #Automation #LearningDevOps #DevOpsTips
Mastering Git Branching Strategies for DevOps Success
More Relevant Posts
-
📝 Day 6 Sharing my DevOps Series..... *git config is used to set and manage Git settings like your username, email, editor, and more. git config --global user.name "Your Name" git config --global user.email "your@email.com" *View commit history git log git log --oneline *Git Branch git branch git branch feature git checkout feature Branch = separate workspace *Git Merge - Combine changes git merge feature Merges feature branch into main Watch for conflicts *Git Clone Copy a repository git clone <repo-url> Downloads project to your system *Git Pull vs Fetch git fetch git pull Fetch = download changes Pull = fetch + merge *Git Push Upload your code git push origin main Sends commits to remote repo *Git Tag Mark important versions git tag v1.0 git push origin v1.0 Useful for releases *Git Stash Save work temporarily git stash git stash pop Useful when switching tasks *Git Rebase vs Merge Two ways to integrate code Merge → keeps history Rebase → cleaner history git rebase main *Git Fork (GitHub Workflow) Post: Contribute to open source Fork → copy repo Clone → local copy Push → your repo PR → contribute git cherry-pick git cherry-pick is used to pick a specific commit from one branch and apply it to another branch. git cherry-pick <commit-id> #GitHub #OpenSource #DevOps #git #cloud #repository.....
To view or add a comment, sign in
-
-
𝗚𝗶𝘁 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴 𝗦𝘁𝗿𝗮𝘁𝗲𝗴𝗶𝗲𝘀 – 𝘀𝗼𝗺𝗲𝘁𝗵𝗶𝗻𝗴 𝗜 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗼𝗼𝗱 𝗼𝗻𝗹𝘆 𝗿𝗲𝗰𝗲𝗻𝘁𝗹𝘆 When I started using Git, I honestly thought branching simply means "create branch, push code, done." That's it. Job over. But while working on actual projects, one thing hit me hard. The wrong branching strategy does not just cause small hiccups. It creates confusion that keeps piling up and becomes very difficult to manage later. So let me share what I understood, in simple words. 𝗠𝗮𝗶𝗻 𝗼𝗿 𝗧𝗿𝘂𝗻𝗸-𝗕𝗮𝘀𝗲𝗱 𝗗𝗲𝘃𝗲𝗹𝗼𝗽𝗺𝗲𝗻𝘁: Everyone commits directly to one main branch with small, frequent updates. Simple to follow, but it needs a lot of discipline from every single person on the team. 𝗙𝗲𝗮𝘁𝘂𝗿𝗲 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴: Every feature gets its own separate branch. Once the work is done, it gets merged back to main. Very easy to manage and track, and honestly the most commonly used approach in most teams I have seen. 𝗚𝗶𝘁 𝗙𝗹𝗼𝘄: This one has dedicated branches for everything, main, develop, feature, release, hotfix. Slightly more process-heavy but very useful once your project or team starts growing. 𝗥𝗲𝗹𝗲𝗮𝘀𝗲 𝗕𝗿𝗮𝗻𝗰𝗵𝗶𝗻𝗴: A separate branch is created for each release and all bug fixes are handled there before anything goes live. Very helpful when you want stable and controlled deployments. One thing I genuinely realised after all this is that there is no perfect branching strategy that works for everyone. It completely depends on your team size, your project, and how frequently you are shipping things. Personally, feature branching felt like the most natural starting point for me and I still use it quite often. hashtag #DevOps hashtag #Git hashtag #GitHub hashtag #CICD hashtag #VersionControl hashtag #CloudComputing hashtag #Docker hashtag #Kubernetes hashtag #AWS hashtag #Automation hashtag #LearningDevOps hashtag #DevOpsTips
To view or add a comment, sign in
-
-
🚀 Git Merge Strategies Explained Simply Many people learn git merge, but they get confused about which merge strategy to use. So here is the simplest explanation with real examples. 💡 🔀 What is Merge in Git? Merge means combining one branch changes into another branch. Example : feature/login → main After testing feature branch, we merge it into main branch. 🌿 1️⃣ Fast Forward Merge If main branch has no new commits, Git directly moves forward. main branch : A → B feature branch : A → B → C After merge : main branch : A → B → C ✅ Very clean history ✅ Best for small tasks Command : git merge feature 🌿 2️⃣ Three-Way Merge If both branches have changes, Git creates a merge commit. main branch : A → B → D feature branch : A → B → C After merge : A → B → C → D → M (M = Merge Commit) ✅ Most common in teams ✅ Keeps branch history safe 🌿 3️⃣ Squash Merge All feature commits become one single commit. feature branch : A → B → C → D After merge : One commit only ✅ Clean Git history ✅ Best for Pull Requests Command : git merge --squash feature 🌿 4️⃣ Rebase + Merge Moves feature commits on latest main branch. Before : main branch : A → B feature branch : A → C → D After : main branch : A → B → C → D ✅ Straight line history ✅ Looks professional Command : git rebase main git merge feature 🌿 5️⃣ Octopus Merge Merge multiple branches together. git merge branch1 branch2 branch3 ✅ Rare use case ✅ Saves time 🎯 Which One Should You Use? Situation Best Merge Small task Fast Forward Team project Three-Way Clean history Squash Linear history Rebase Many branches Octopus 💼 Real-Time Usage 🔹 Startups → Squash Merge 🔹 Agile Teams → Rebase 🔹 Enterprises → Three-Way Merge 🔹 Open Source → Mixed Strategy #Git #GitHub #DevOps #Merge #CI_CD #Jenkins #Linux #AWS #Kubernetes #Freshers #Tech #Learning #VersionControl
To view or add a comment, sign in
-
-
🚀 Beyond Git Commands — Thinking Like a Senior Engineer Most developers know how to use Git. Fewer understand how it actually works. From exploring Git’s content-addressable storage (blobs, trees, commits) to mastering concepts like rebase vs merge, revert vs reset, and detached HEAD, I deep-dived into what makes Git a powerful distributed system — not just a tool. 💡 Key takeaway: Git isn’t just version control — it’s a data structure + workflow engine + collaboration backbone for modern engineering. Understanding internals helps you: ✔ Debug faster ✔ Handle production issues safely ✔ Design scalable branching strategies ✔ Work confidently in large teams If you're preparing for interviews or aiming to level up — focus on why Git works, not just how to run commands. #Git #GitHub #DevOps #SoftwareEngineering #InterviewPrep #Cloud #LearningJourney
To view or add a comment, sign in
-
👨💻 50-day journey to revisit and strengthen my DevOps engineering skills 📌 Day 2/50 📌 ⚙️ Tools I’ll be working with: Git | GitHub Actions Today, I focused on how local Git operations turn into real CI/CD execution using GitHub Actions. In production environments, every pipeline execution is a result of developer actions performed locally, making it critical to understand the complete flow from code creation to deployment trigger. 🔄 Flow Overview: 💠 Developer writes code locally 💠 Commits and pushes using Git 💠 Code is pushed to GitHub 💠 GitHub Actions workflow is triggered 💠 CI/CD pipeline executes (build, test, deploy) ➡️ Flow attached below 👇 📌 Note: Key CI/CD stability considerations as covered in Day 1 are critical. ➡️ For a more detailed understanding of GitHub Workflows and Actions, I’ve referred to the official documentation—feel free to explore it for deeper insights 🔗 https://lnkd.in/gm77PY7y 🚨 Possible Issue Scenario: A CI pipeline was set to trigger on every push to the main branch. A developer pushed changes without syncing with the latest remote updates, causing merge conflicts and pipeline failure due to inconsistent code. 🛠️ Resolution: Pulled latest changes from the repository Resolved conflicts locally Pushed updated code Pipeline re-triggered and executed successfully 💡 Always sync before pushing. ➡️ The key takeaway is that CI/CD pipelines are only as reliable as the version control practices behind them. Proper use of git pull, disciplined commits, and clean synchronization between local and remote repositories ensures smooth pipeline execution and avoids unnecessary failures. #DevOps #git #cicd #Github #skills #GithubCommands #Branchingstrategy #GithubActions #GithubDocs #Reskill #Workflow #Syntax
To view or add a comment, sign in
-
-
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
To view or add a comment, sign in
-
-
🚀 Master Git Like a Pro — Save This Cheat Sheet! If you're in DevOps, SRE, or Software Engineering… 👉 Git is your daily weapon. But remembering commands = 😵💫 So here’s a quick breakdown you’ll actually use: 🔹 Basic Commands • git init → Start a new repository • git clone <url> → Copy repo locally • git status → Check changes • git add . → Stage all changes • git commit -m "msg" → Save changes 🌿 Branching • git branch → List branches • git checkout -b feature → Create + switch branch • git merge feature → Merge into main • git branch -d feature → Delete branch 🌍 Remote • git pull → Fetch + merge latest changes • git push → Upload your commits • git remote -v → Show remote repos ⏪ Undo Changes • git checkout -- file → Discard changes • git reset HEAD file → Unstage file • git revert <commit> → Undo commit safely • git reset --hard → Reset everything (⚠️ careful!) 📜 Logs & Debugging • git log → Full history • git log --oneline → Compact view • git diff → See changes • git blame file → Who changed what 📦 Stashing • git stash → Save work temporarily • git stash pop → Restore work • git stash list → View stashes 💡 Pro Tips ✔️ Commit small, commit often ✔️ Use meaningful commit messages ✔️ Always pull before push ✔️ Use branches — never work directly on main 🔥 If this helps you: ✔️ Save it (you’ll need it later) ✔️ Follow for more DevOps/SRE content #Git #DevOps #SRE #SoftwareEngineering #Coding #GitCommands #VersionControl #LearnGit #ProgrammingTips #DevOpsEngineer #Cloud #Kubernetes #Terraform #CareerGrowth #TechCommunity #100DaysOfCode
To view or add a comment, sign in
-
-
📝 Day 5 of Sharing my DevOps Series... *Git Basics What is Git? Git is a distributed version control system used to: Track code changes Collaborate with teams Manage project history *Why Git is Used? Track code changes Maintain version history Work with multiple developers Rollback to previous versions Work in parallel using branches *Git Architecture Working Directory Where you create/edit/delete files Staging Area Middle layer between working directory & Local repository Stores changes before commit Git Repository Stores all versions, history & metadata Initialize repository git init Check status git status Add file to staging git add file.txt Commit changes git commit -m "First commit" *File States in Git Untracked → New file (not added) Modified → Changed but not staged Staged → Ready to commit *Commands ls # List files ls -a # Show hidden files mkdir folder # Create directory cd folder # Change directory *Git Commit Options git commit -m "message" # Normal commit git commit -am "message" # Add + commit (tracked files only) *What is a Branch? A branch in Git is used to work on features independently without affecting the main code. *List Branches git branch - Shows all available branches Create a New Branch - git branch dev Creates a new branch named dev *Switch Branch git checkout dev git switch dev Move from one branch to another Create + Switch (Shortcut) git checkout -b feature Delete Branch git branch -d dev Deletes branch (safe delete) git branch -D dev Rename Branch git branch -m old-name new-name Rename a branch View All Branches (Local + Remote) git branch -a *Git Logs git log # Full history git log --oneline # Short history *Remote Repository (GitHub) git remote add origin <repo_url> git push origin master- Push local commits to remote repository *main information about git: git init → Initialize repo git add → Stage changes git commit → Save changes git status → Check status git branch → Manage branches git merge → Combine branches git push → Upload to remote git clone → Copy repo #DevOps #CareerGrowth #Cloud #AWS #Infrastructure #CloudComputing #AWS #TechLearning #DevOps #LearningInPublic #TechJourney #git #github
To view or add a comment, sign in
-
-
🚀 Git Cheat Sheet – Commands You Should Know! If you're working in DevOps, development, or any CI/CD pipeline, mastering Git is non-negotiable. Here's a quick breakdown to level up your version control game 👇 🔹 Create Initialize and clone repositories git init git clone <repo> 🔹 Update Track and manage changes git pull, git fetch git add, git commit, git merge 🔹 Branching Work safely without affecting main code git branch, git checkout, git merge 🔹 Revert Undo mistakes like a pro git reset, git revert, git checkout 🔹 Publish Push your work and collaborate git push, git format-patch 🔹 Monitor (Show) Keep track of everything git status, git log, git diff 💡 Understanding the Git Workflow (Create → Branch → Commit → Publish) is key to efficient collaboration and clean code management. 📌 Save this cheat sheet for quick reference and boost your productivity! 🔗 Let’s connect and grow together: https://lnkd.in/gpakHghj #Git #DevOps #VersionControl #CI_CD #SoftwareEngineering #Cloud #Learning #Developers
To view or add a comment, sign in
-
-
🗓️ Day 29/100 — 100 Days of AWS & DevOps Challenge Today's task wasn't just Git — it was the full engineering team workflow that makes collaborative development actually safe. The requirement: Don't let anyone push directly to master. All changes must go through a Pull Request, get reviewed, and be approved before merging. This is branch protection in practice. Here's the full cycle: Step 1 — Developer pushes to a feature branch (already done) $ git log --format="%h | %an | %s" # Confirms user commit, author info, commit message Step 2 — Create the PR (Log into GIT) - Source: story/fox-and-grapes - Target: master - Title: Added fox-and-grapes story - Assign a user as reviewer Step 3 — Review and merge (log into GIT as reviewer) - Files Changed tab — read the actual diff - Approve the PR - Merge into master Master now has user story. And there's a full audit trail of who proposed it, who reviewed it, who approved it, and when it merged. Why this matters beyond the task: - A Pull Request is not a Git feature - it's a platform feature. Git only knows commits and branches. The PR is a Git/GitHub/GitLab construct that adds review, discussion, approval tracking, and CI/CD status checks on top of a branch merge. When companies say "we require code review before anything goes to production," this is the mechanism. When GitHub Actions or GitLab CI runs tests on every PR — this is where that hooks in. When a security audit asks "who approved this change?" — the PR has the answer. The workflow is identical across Git, GitHub, GitLab, and Bitbucket: push branch → open PR → assign reviewer → review diff→ approve → merge → master updated → branch deleted Full PR workflow breakdown on GitHub 👇 https://lnkd.in/gpi8_kAF #DevOps #Git #PullRequest #CodeReview #Gitea #BranchProtection #100DaysOfDevOps #KodeKloud #LearningInPublic #CloudEngineering #GitOps #TeamCollaboration
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