Day 30 - Git Hard Reset #100DaysOfDevOps🧑💻 Today’s task focused on rewriting Git history in a controlled environment. A skill that directly translates to real-world production support. The Nautilus team had a test repository where multiple temporary commits were pushed. The requirement was clear: clean up the repository so only two commits remain in history with both the branch pointer and HEAD aligned to one of the commits. To achieve this, I navigated to the repository, identified the correct commit using "git log --oneline", and executed a "git reset --hard commit-hash" to move the branch pointer and HEAD back to the required state while cleaning the working tree. Since this rewrites commit history, I followed up with a "git push --force" to update the remote repository safely. This reflects real production scenarios where accidental commits, sensitive data exposure, or test changes must be surgically removed while keeping repository integrity intact. Understanding when and how to rewrite history, and the risks involved, is critical in DevOps and release engineering workflows. Full documentation and command breakdown available here: https://lnkd.in/g-HZxwzw Another solid step forward. Excited to tackle tomorrow’s challenge and keep building production-ready Git expertise. 🚀 #DevOps #Git #VersionControl #CloudEngineering #SRE #Linux #ContinuousLearning
Git Hard Reset: Cleaning Repository History with Git Reset --hard
More Relevant Posts
-
🔁 Git Reset vs Git Revert — I Used to Think They Were the Same… Early on, I assumed both commands did one simple thing: “Undo changes” But while working on a project, I realized they solve completely different problems. And using the wrong one can break your workflow. 🔙 git reset (Rewrites History) - Moves the branch pointer backward - Can remove commits from history - Affects your local repository Use when: - Undoing local commits - Cleaning up commits before pushing Common Commands: - git reset --soft HEAD1 → Undo commit, keep changes staged - git reset --mixed HEAD1 → Undo commit, keep changes unstaged - git reset --hard HEAD~1 → Remove commit + delete changes Example: Fixing unclear commits before pushing ↩ git revert (Safe Undo) - Creates a new commit that reverses changes - Keeps history intact - Safe for shared repositories Use when: - Changes are already pushed - Working in a team environment Common Commands: - git revert HEAD → Revert last commit - git revert <commit-id> → Revert specific commit Example: Reverting a faulty production change 🎯 Takeaway: Never use reset on shared branches. Prefer revert when collaborating. #Git #GitHub #DevOps #VersionControl
To view or add a comment, sign in
-
🚀 DevOps Journey Update Spent some time revisiting and brushing up on Git & GitHub fundamentals — tools that quietly power almost every modern development and DevOps workflow. Refreshed concepts like: 🔹 Version Control – tracking changes without the “who broke this?” mystery 🔹 Branches – experimenting safely without disturbing main 🔹 Rollback & Revert – the DevOps safety net when things go sideways 🔹 SSH Authentication – secure GitHub access without the password dance 🔹 Tags & Semantic Versioning – keeping releases organized (v1.0.0, v1.1.0, etc.) Also went through the usual Git muscle memory workout: git clone • git add • git commit • git push • git pull • git branch • git merge • git revert It’s interesting how something developers use daily becomes even more important from a DevOps perspective — where traceability, collaboration, and reliable releases really matter. Next in my DevOps journey: Linux Servers 🐧 Time to spend more quality time with the terminal. #DevOpsJourney #LearningInPublic #Git #GitHub #DevOps #Linux
To view or add a comment, sign in
-
-
🚀 Successfully Completed a Git Repository Task in a Multi-User Environment Today, I worked on a hands-on Git task as part of the Nautilus project development workflow in a simulated multi-user environment. The challenge involved managing a repository with restricted permissions on a shared storage server. Task Overview: A repository /usr/src/kodekloudrepos/beta was created and cloned from /opt/beta.git. A sample index.html file was provided on the jump host. The goal was to copy the file into the cloned repository, commit the changes, and push to the master branch, all while adhering to lab rules without changing repository ownership or configurations. Steps I Followed: 1. Transferred the file securely: scp /tmp/index.html natasha@ststor01:/home/natasha/ Copied the file from the jump host to the storage server under the user’s home directory. 2. Moved the file into the repository: sudo mv /home/natasha/index.html /usr/src/kodekloudrepos/beta/ Used sudo to place the file in the root-owned repository without modifying permissions. 3. Performed Git operations: cd /usr/src/kodekloudrepos/beta git add index.html git commit -m "Added index.html" git push origin master Successfully committed and pushed the change to the remote repository. Key Takeaways: Handling Git repositories in multi-user environments requires understanding file ownership and permissions. Using sudo judiciously allows completing tasks without altering repo configuration, which is critical in production-like environments. Hands-on labs like these reinforce best practices for DevOps workflows, secure file management, and collaborative version control. Feeling accomplished for navigating the tricky ownership constraints and completing the task successfully! 💪 #Git #DevOps #VersionControl #Linux #KodeKloud #GitWorkflow #Collaboration #TechSkills #LearningByDoing #ContinuousLearning
To view or add a comment, sign in
-
-
Day 11 of DevOps I thought I knew Git. Turns out I only knew GitHub. Git is a distributed version control system : it tracks every change you make to your code, locally on your machine. GitHub is just where you store it online. They are not the same thing. Today I actually used Git commands for the first time. Here's how it went: git init : initialized my first local repository git add : staged my changes git commit -m : saved my first snapshot But first commit failed. Git threw an identity error : it didn't know who I was. Turns out Git requires you to set your identity before committing anything. git config --global : fixed it permanently Then things got interesting: git diff : showed me exactly what changed between versions git log : showed my entire commit history with IDs git reset --hard : rolled back to a previous version instantly That last one hit different. One command and your code goes back in time. Git doesn't just save your work. It saves every version of it. Moral of the day: GitHub is the house. Git is the foundation it's built on. #DevOps #Git #LearningInPublic
To view or add a comment, sign in
-
Git is a distributed version control system created by Linus Torvalds. It helps developers track changes in source code, collaborate with teams, and manage different versions of a project efficiently. Key Features of Git: Tracks code changes (version history) Supports branching and merging Works offline (local repositories) Fast and lightweight Enables collaboration among developers #devops #devsecops #opensource #cloudcomputing #jenkins #github #githubaction #cloudstackh
To view or add a comment, sign in
-
-
Git is a distributed version control system (VCS) used to track changes in source code during software development. It allows developers to manage code history, collaborate with others, and maintain multiple versions of a project efficiently. #kubernetes #devops #devsecops #cloudcomputing #git #github #gitlab #jenkins #opensource
Git is a distributed version control system created by Linus Torvalds. It helps developers track changes in source code, collaborate with teams, and manage different versions of a project efficiently. Key Features of Git: Tracks code changes (version history) Supports branching and merging Works offline (local repositories) Fast and lightweight Enables collaboration among developers #devops #devsecops #opensource #cloudcomputing #jenkins #github #githubaction #cloudstackh
To view or add a comment, sign in
-
-
If anyone call it laziness, I won't defend much as I know switching btw 2 terminals and 2-3 clicks to get things done shouldn't be overwhelming but what if we can do it from same terminal. I'm talking about creating repos from local itself unlike "GitHub" which doesn't allow remote repo creation from local git push. Have you ever tried creating remote repo from local? With Gitlab it is possible. Note: This feature is available on all Gitlab offerings. I just figured it out today. git init git add . git commit -m "" git remote add origin ssh/https://gitlab-**/username/<any-name>.git git push --set-upstream origin master/main You will have your remote repo with name shared in git remote cmd ready to use as normal repo. Private by default and requires repo creation privileges. #github #gitlab #azurerepos #branches #releases #devops #scrum #development #fearures #enterprize
To view or add a comment, sign in
-
🚀 DevOps journey week 04 — Git, from basics to production-ready. What I covered this week: 1. 🔧 Setup & Core Concepts Configured Git identity, initialized repos Understood the 3-stage flow: working directory → staging area → repository 🌿 Branches & Remote Collaboration Created & managed branches, pushed to GitHub git fetch vs git pull — one looks, the other touches Clone = local copy, Fork = your own remote copy 2. 🔀 Merge, Rebase, Stash & Cherry-pick Fast-forward merge = linear history, merge commit = full story preserved Rebase = cleaner history, but never on shared branches Stash = park unfinished work without a messy commit Cherry-pick = apply one specific commit, nothing more 3. ⏪ Reset, Revert & Branching Strategies --soft keeps changes staged, --mixed unstages them, --hard wipes everything git revert = safe undo on shared branches, never rewrites history GitFlow for versioned releases, GitHub Flow for continuous deployment, Trunk-Based for fast DevOps teams 💡 Key takeaway: Git isn't a backup tool — it's how teams ship fast without breaking each other's work. #DevOps #Linux #AWS #CloudComputing #LearningJourney #ContinuousLearning #90DaysOfDevOps #DevOpsKaJosh #TrainWithShubham
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
-
-
🚀 Day 2 of My DevOps Journey — Git (Where Real Collaboration Begins) Yesterday was Linux. Today, I stepped into Git — the backbone of DevOps workflows. At first, Git felt simple… until I actually started working with it. 🔹 What I Practiced: Initializing a repo (git init) Branching strategy (main, feature/*) Merging vs Rebasing Fixing merge conflicts Using git stash when switching work Writing meaningful commit messages 🔹 Real Challenge I Faced: I accidentally: ❌ Made changes on the wrong branch ❌ Used stash incorrectly ❌ Faced merge conflicts And honestly… this is where real learning started. 🔹 What I Learned: ✔ git rebase helps keep history clean ✔ Merge conflicts are not errors — they are decisions ✔ Commit messages matter more than we think 💡 Key Learning: “Git is not about commands. It’s about thinking in versions.” I also practiced: Squashing commits using interactive rebase Understanding how teams collaborate using PRs This felt like a big step toward real-world DevOps work. Next → Docker (containers, images, real deployment) If you’ve struggled with Git before, you’re not alone. Let’s grow together 🤝 #DevOps #Git #VersionControl #Cloud #LearningInPublic #BuildInPublic #CI_CD
To view or add a comment, sign in
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
Great job 👍👏. Keep it up