Git and GitHub for DevOps

π Conquering Git & GitHub: My Challenge Adventure
π What is Git and Why Is It Important?
Git is a distributed version control system used by developers to track changes in code over time. It allows multiple people to collaborate on a project without overwriting each other's work. You can roll back to earlier versions of code, work on multiple features simultaneously, and keep everything organized. π‘
π§ Why Git Matters in DevOps
In DevOps, Git is absolutely essential because:
π οΈ Automation: CI/CD tools integrate seamlessly with Git to automate testing and deployments.
π¦ Infrastructure as Code: Git stores not just application code, but infrastructure configurations.
π€ Collaboration: Enables cross-functional teams to develop, test, and deploy code collaboratively.
π§ͺ Safe experimentation: Easily create branches, test features, and merge once verified.
π Git vs GitHub: Whatβs the Difference?
| Feature | Git | GitHub |
| π Tool Type | Version Control System | Hosting platform for Git repos |
| π» Location | Runs locally on your machine | Cloud-based (GitHub.com) |
| π Security | Local repository security | Online collaboration & access control |
| π₯ Usage | Tracks code history | Enables sharing & team workflows |
πΌ Challenge Tasks Breakdown
β Task 1: Fork & Clone the Repository
I forked the one repository on GitHub.
Cloned it locally using HTTPS:
git clone <your-fork-url> cd 2025/git/01_Git_and_Github_Basics
β Task 2: Initialize a Local Repository and Create a File
Created a new folder for the challenge:
mkdir challenge cd challengeInitialized Git:
git initCreated a file called
info.txtwith my details and added it to Git and committed the changes:git add info.txt git commit -m "Initial commit: Add info.txt with introductory content"
β Task 3: Configure Remote with PAT & Push
π To simplify authentication (for this exercise only), I configured Git to use a PAT (Personal Access Token):
git remote add origin https://<your-username>:<your-PAT>@github.com/<your-username>/90DaysOfDevOps.git
If origin already exists:
git remote set-url origin https://<your-username>:<your-PAT>@github.com/<your-username>/90DaysOfDevOps.git
Pushed changes to GitHub:
git push -u origin mainVerified everything synced correctly using pull request:
git pull origin main
β Task 4: Explore Your Commit History
π΅οΈ I checked the commit log to review history and hashes:
git log
This helped me understand the flow of changes and track each commit with confidence.
β Task 5: Advanced Branching & Switching
Created a new feature branch:
git branch feature-update git switch feature-updateEdited
info.txtwith more details, then committed
π I then opened a Pull Request on GitHub to merge feature-update into main.
π₯ (Optional) I created an experimental branch to simulate a merge conflict, merged it into feature-update, resolved the conflict manually, and committed the fix.
β Task 6: Branching Strategies Explained
Branching strategies are the backbone of collaborative development. Here's why they matter:
π§© Isolating Features and Fixes: Branches allow developers to work on features or bug fixes independently without affecting the
maincode.π¦ Parallel Development: Multiple developers can work simultaneously using different branches.
π§Ό Reducing Merge Conflicts: Proper branch management helps prevent messy conflicts during integration.
π Enabling Code Reviews: Teams can review and test code in branches before merging to production.
ποΈ Common branching strategies include:
mainormaster: Stable production-ready code.dev: Staging area for integration.feature/*: Used for developing new features.hotfix/*: For urgent bug fixes in production.release/*: Prepares code for release.
π Wrapping Up
This Git & GitHub challenge was a great deep dive into real-world version control workflows. From setting up remotes using PATs to branching, merging, and resolving conflicts, I now feel more confident in using Git in a collaborative DevOps environment. π




