Mastering DevOps Git – Lecture 04 | Rebase, Stash, Cherry-Pick & Squash Explained

Опубликовано: 12 Июнь 2026
на канале: Raman Sharma
21
0

Welcome to Mastering DevOps – Git Lecture 04 🚀

In this lecture, we cover advanced Git concepts used in real DevOps environments and production workflows.

You will learn:

✔ Git Rebase vs Merge
✔ Interactive Rebase
✔ Git Stash (save, list, pop)
✔ Cherry Pick
✔ Squash Commits
✔ Rewriting History Safely
✔ Real DevOps Workflow Scenarios

This lecture is extremely important for:

DevOps engineers

Production support

Code reviewers

Interview preparation

🔹 Commands Practiced in This Lecture
Initial setup
git init
new-item -path m1
new-item -path m2
new-item -path m3
git add .
git commit -m "m1" m1
git commit -m "m2" m2
git commit -m "m3" m3

Branch & Feature
git branch feature
git checkout feature
new-item -path f1
git add .
git commit -m "f1"

git checkout -
new-item -path m4
git add .
git commit -m "m4"

Merge
git merge master

Rebase
git rebase master
git log --oneline --graph

Stash
git stash save "dev1.java file is stashed"
git stash list
git stash pop

git stash save "dev1.java file is stashed" .\dev1.java
git stash save "dev11.java file is stashed" .\dev11.java

Cherry Pick
git cherry-pick 9f565ce

Squash Commits
git rebase HEAD~3
git rebase -i HEAD~3
git log --oneline
🔥 Concepts Covered
✅ Git Rebase

Difference between merge and rebase

Linear history

Rewriting commits

✅ Interactive Rebase

Squashing commits

Cleaning commit history

Editing commit messages

✅ Git Stash

Temporarily saving work

Switching branches safely

Multiple stash handling

✅ Cherry Pick

Applying specific commit to another branch

Production hotfix scenario

✅ Squash

Combining multiple commits into one

Clean project history before PR

🎯 Real DevOps Scenario Explained

Code owner reviewing developer code

Production quick fix

Stashing incomplete work

Applying hotfix using cherry-pick

Cleaning history using squash

git rebase tutorial, git rebase interactive, git stash tutorial, git stash pop example, git cherry pick tutorial, git squash commits, git rebase vs merge, advanced git tutorial, mastering devops git lecture 4, git devops training, git interview questions advanced, git stash multiple files, git history rewrite, git practical devops, git workflow advanced, git production hotfix, git cherry pick example, git hands on tutorial, devops git full course, git advanced commands