Every time we commit to a project, we often end up with multiple small commits before finishing a feature. Looking back at the history, it's a mess of "commit done", "final commit", "finally final commit" commits. This is where interactive rebase helps. git rebase -i HEAD~N opens an editor showing the last N commits, each set to pick by default. You can replace pick with: squash - merge commits and combine their messages fixup - merge commits and discard the message edit - pause at that commit to make changes before continuing Before rebase: abc1234 commit done abc1235 final commit abc1236 finally final commit abc1237 forgot one thing After squash into one: abc9999 feat: add product ranking feature In a team, every developer can clean up their feature branch before raising a PR. Reviewers see one meaningful commit instead of 10 noisy ones. Clean history is not just aesthetic. It makes git bisect and git blame actually useful when debugging production issues. #Git #DataEngineering #DevOps
Simplify Git Commits with Interactive Rebase
More Relevant Posts
-
“𝐃𝐨𝐧’𝐭 𝐜𝐨𝐧𝐭𝐫𝐢𝐛𝐮𝐭𝐞 𝐭𝐨 𝐭𝐡𝐞 𝐫𝐞𝐩𝐨 𝐰𝐢𝐭𝐡 𝐝𝐢𝐫𝐭𝐲 𝐜𝐨𝐦𝐦𝐢𝐭𝐬.” Early in my career, I rushed a fix. My PR looked like this: • Initial commit • Typo fix • Debugging • Updated README 1 • Updated README 2 • Plz work • Final FINAL fix It got clumsy and junky. The lesson? 𝐌𝐞𝐬𝐬𝐲 𝐡𝐢𝐬𝐭𝐨𝐫𝐲 = 𝐦𝐞𝐬𝐬𝐲 𝐭𝐡𝐢𝐧𝐤𝐢𝐧𝐠 (at least from the outside). 𝐂𝐥𝐞𝐚𝐧 𝐜𝐨𝐦𝐦𝐢𝐭𝐬 𝐛𝐮𝐢𝐥𝐝 clarity and make it easier to update features in the future. Commands every serious developer should master: → 𝐠𝐢𝐭 𝐬𝐭𝐚𝐬𝐡 Temporarily save your work to switch tasks instantly. → 𝐠𝐢𝐭 𝐜𝐨𝐦𝐦𝐢𝐭 --𝐚𝐦𝐞𝐧𝐝 Fix your last commit without adding noise. → 𝐠𝐢𝐭 𝐫𝐞𝐛𝐚𝐬𝐞 -𝐢 𝐇𝐄𝐀𝐃~𝐧 Clean, reorder, or squash commits into one clear story. → 𝐠𝐢𝐭 𝐜𝐡𝐞𝐫𝐫𝐲-𝐩𝐢𝐜𝐤 Move only the changes you need (perfect for hotfixes). → 𝐠𝐢𝐭 𝐫𝐞𝐟𝐥𝐨𝐠 Your safety net — recover “lost” commits anytime. → 𝐠𝐢𝐭 𝐫𝐞𝐬𝐞𝐭 --𝐬𝐨𝐟𝐭 𝐇𝐄𝐀𝐃~𝟏 Undo last commit, keep your changes ready. → 𝐠𝐢𝐭 𝐝𝐢𝐟𝐟 Review changes before you embarrass yourself. The truth? Good developers write code. 𝐆𝐫𝐞𝐚𝐭 𝐝𝐞𝐯𝐞𝐥𝐨𝐩𝐞𝐫𝐬 𝐩𝐫𝐞𝐬𝐞𝐧𝐭 𝐢𝐭 𝐜𝐥𝐞𝐚𝐧𝐥𝐲. Do you clean your commit history — or ship the chaos? 👇 #BackendEngineering #Git #CleanCode #DeveloperMindset #Coding #CodingIsTherapy
To view or add a comment, sign in
-
-
Day 101. I'm back on the consistency grind. No fluff. Let's talk about something I've been sharpening — Git DAGs. You've used git commit, git reset, git revert. But do you actually know what's happening under the hood? DAG = Directed Acyclic Graph. Directed → commits point to their parent(s). Time only moves forward. Acyclic → no loops. History never circles back on itself. Graph → it's a network of nodes (commits) and edges (parent relationships). Every commit is a snapshot — not a diff, not a delta. A full picture of your entire repo at that moment, stored as a SHA hash. Now the three commands people confuse: git checkout → moves your HEAD to a different commit or branch. You're not changing history — you're just looking at a different snapshot. Like rewinding a film without cutting any frames. git reset → rewrites history. Moves the branch pointer backward. Three flavors: --soft → keeps your changes staged --mixed → keeps changes unstaged --hard → wipes everything. No mercy. git revert → the safe option. Creates a new commit that undoes a previous one. History stays intact. This is what you use on shared branches. I've done Git before. But "done" and "sharp" are two different things. I'm going deeper — understanding conflicts at the DAG level, debugging merges, knowing why a rebase breaks so I can fix it, not just panic-force-push. If you're learning Git too, stop memorizing commands. Learn the graph. Day 101. Still here. Still building. #Git #DevOps #100DaysOfCode #CloudEngineering #Infracodebase #LearningInPublic
To view or add a comment, sign in
-
-
Day 25 of learning and practicing DevOps🔄 Focused on one of the important Git skill — undoing mistakes Worked on • Understanding git reset with soft, mixed and hard modes • Learning how git revert safely undoes changes without breaking history • Comparing reset vs revert in real scenarios • Exploring branching strategies like GitFlow, GitHub Flow and Trunk-Based • Understanding when to use each strategy in real projects Important part : git reset can rewrite history and even delete changes git revert creates a new commit and keeps everything safe Learning today: Reset is for local cleanup Revert is for team safety Branching strategy defines how a team builds, releases and collaborates Here are my notes https://lnkd.in/gr5CNBTU 🌐 #DevOps #Git #VersionControl #LearningInPublic #90DaysOfDevOps #TrainWithShubham
To view or add a comment, sign in
-
Stop the "Stash & Switch" madness. 🛑 We’ve all been there: You’re deep in a feature, your workspace is a mess of half-finished logic, and suddenly... a critical bug hits production. Most devs reach for git stash. Some make a messy "WIP" commit. But there’s a better way that most people ignore: Git Worktree. Instead of flipping a single folder between branches, Git Worktree lets you "check out" multiple branches into separate folders simultaneously, all linked to the same local repo. Why is this a game-changer? ✅ Zero Context Switching: Keep your feature code open in one VS Code window and your hotfix in another. No stashing required. ✅ Parallel Testing: Run a heavy test suite or build process on one branch while you keep coding on the other. ✅ Code Reviews: Need to test a teammate's PR? Open it in a new worktree without touching your current progress. ✅ No More npm install Loops: If branches have different dependencies, worktrees keep their respective node_modules intact. No more re-installing every time you switch. The Magic Command: git worktree add ../hotfix-folder hotfix-branch It’s one of those "once you know it, you can't go back" tools. Are you still stashing, or have you made the switch to Worktrees? Let’s hear your workflow hacks in the comments! 👇 #Git #WebDevelopment #SoftwareEngineering #DevOps #ProgrammingTips #Efficiency
To view or add a comment, sign in
-
One thing I've noticed building with Claude Code: it loves to lay out 4-6 week sprints in Plan Mode, completely serious, as if it isn't about to knock out most of it in a weekend. Powerful tool. Very silly estimator. What actually helped me calibrate: I stopped letting it estimate in time and started asking it to break work into phases (a bundle of related features), then blocks (one feature or part of a larger one), then chunks (described as roughly 1-2 hours of pre-AI work each). Every finished chunk is a reminder for me to git commit. Every commit is a natural place to pause, assess, and manage usage limits before moving on. Then I turned this practice into a skill so I didn't have to think about it again. If you're a non-engineer just getting started with Claude Code, treat the timeline as noise and the structure as signal. You'll get a much more accurate sense of what you're actually building — and how fast. This Sunday (Apr 26 8am PT), I'm going deeper on exactly this — how to build a personal software development lifecycle, and make vibe coding a repeatable high quality skill. Joining me for a Maven lightning lesson: **Become an AI Builder: The Right Way to Vibe-Code.** Free to join → https://maven.com/p/ba6812
To view or add a comment, sign in
-
🔍 Understanding Pull Requests & Code Review in My Workflow After implementing Git branching in my projects, the next step I focused on was using pull requests and code reviews to manage changes more effectively. Pull requests allow changes from one branch to be reviewed before merging, while code review ensures the quality and correctness of those changes. Instead of directly merging code, I started following a structured review process. Here’s how I use it: 📌 1. Push changes to a feature branch git push origin feature/task-name 📌 2. Create a pull request Compare feature branch with main branch 📌 3. Review changes before merging Check code quality Verify logic Identify possible issues 📌 4. Make necessary updates if required Commit changes based on feedback 📌 5. Merge the pull request Only after ensuring everything is correct I started using this process while working on multiple changes, where reviewing code before merging helped prevent errors and maintain consistency. This approach helps me: ✔️ Catch issues before they reach the main branch ✔️ Maintain better code quality ✔️ Keep track of all changes clearly ✔️ Improve collaboration and accountability Understanding pull requests and code reviews has helped me move towards a more structured and professional development workflow. #Git #PullRequest #CodeReview #VersionControl #SoftwareDevelopment #DeveloperWorkflow
To view or add a comment, sign in
-
Manage Git like a pro—right inside VS Code 🔥 Tired of switching between the terminal and your editor for Git tasks? Meet "Interactive GIT Log" – a VS Code extension that turns Git into a visual experience. ✅ See your commit history as an interactive graph ✅ Manage branches with a clean visual interface ✅ Drag-and-drop to rebase (yes, really) ✅ Stage, commit, and revert files without CLI commands ✅ View pull request status (integrates with GitHub CLI) This extension streamlines most Git workflows and helps you stay focused inside your editor. No more memorizing flags or digging through logs. 👉 Try it here: https://lnkd.in/eqfQ9Tmx #Git #VSCODE #DevTools #WebDevelopment #Coding #SoftwareEngineering #Productivity #GitHub #DeveloperExperience #CleanCode #VersionControlling
To view or add a comment, sign in
-
There is a line between using Git and understanding it. Most developers cross it eventually. Many never do. The user searches for the command that solves the problem. The practitioner reasons from models: — What state is the repository in? — What operation moves it to the desired state? — What are the side effects? The user panics when git log --graph looks like a woven basket. The practitioner reads it like a map. The user types git push --force when rejected. The practitioner runs git fetch, reads what is incoming, integrates properly. The user treats merge conflicts as Git problems. The practitioner recognises them as coordination signals. The gap is not experience. Not time. It is four mental models: 1. HCAT: every Git feature solves History, Collaboration, Attribution, or Time Travel 2. Object model: four types, content-addressed, linked by hash 3. Three-state model: working tree, staging, repository 4. Reflog: the safety net is real. Almost nothing is permanently gone. Understand these and Git stops being surprising. That is the book I wrote. That is the transformation it offers. 📚 Stop Breaking Git. Link in my featured section. Where are you on this spectrum right now? Tag one engineer who you think would get value from crossing this line. #Git #SoftwareEngineering #CareerGrowth #TechLearning #MentalModels
To view or add a comment, sign in
-
Hello #Connections 👋 😂 2 developers working on the same branch be like… 💻 Dev 1: git push 💻 Dev 2: git push ⚔️ Silent war begins… Then comes the ultimate move — 💀 git push --force And suddenly… – Code disappears ❌ – History rewritten 📜 – Teammate shocked 😳 Welcome to the dark side of version control 😅 On a serious note 👇 🔍 Git is powerful, but with great power comes great responsibility. 👉 Using "--force" without coordination can: – Overwrite someone else's work – Break shared history – Create chaos in the team 💡 Better approach: ✔️ Use feature branches ✔️ Communicate before force push ✔️ Prefer "git pull --rebase" ✔️ Use protected branches Great developers don’t just write code… they also respect collaboration. 🤝 #git #developers #codinglife #programming #softwareengineering #devlife #debugging #tech #memes #techmemes #programmingmemes #codermemes #developermemes #relatable #funny #workmemes #technology #programming #softwareengineering #coding #relatable #officememes
To view or add a comment, sign in
-
🔀 git merge vs git rebase — what actually happens under the hood Most devs know the commands. Fewer understand what Git is actually doing to your commit history. ────────────────────── 🔵 git merge When you merge feature into main, Git finds the common ancestor, combines the changes, and creates a merge commit with two parents. (: History preserved (: Branch context visible (: Safe on shared branches (: Never rewrites history ────────────────────── 🟢 git rebase Rebase lifts your feature commits off their base and replays them one by one on top of the target branch — giving you a perfectly linear history. :) Replayed commits get new SHA hashes :) Original commits are discarded :) Dangerous on shared branches ────────────────────── ⚡ So which should you use? → merge when working on shared or public branches → rebase to clean up your local branch before a PR → Never rebase commits others are already building on ────────────────────── 🏆 The golden rule: Rebase locally. Merge publicly. ────────────────────── What's your team's workflow — merge commits or linear history? Drop it in the comments 👇 #git #softwaredevelopment #devtips #programming #versioncontrol
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