1. Which is a safe scenario for interactive rebase?
Rewrite only private/unpushed history to avoid disrupting collaborators.
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Git & Version Control · Question Set
Rebase, Cherry-pick & History Rewriting (Advanced) interview questions for placements and exams.
Questions
12
Included in this set
Subject
Git & Version Control
Explore more sets
Difficulty
Mixed
Level of this set
Go through each question and its explanation. Use this set as a focused practice pack for Git & Version Control.
Rewrite only private/unpushed history to avoid disrupting collaborators.
For complete preparation, combine this set with full subject-wise practice for Git & Version Control. You can also explore other subjects and sets from the links below.
Rewrites change commit IDs, breaking collaborators’ history and remotes. Mitigate with protected branches, disallowing force-push, using merge on shared branches, and rewriting only private branches.
`squash` merges commits and lets you edit a combined message; `fixup` discards the later message.
Create `fixup! <subject>` commits to mark quick corrections. With `--autosquash`, interactive rebase auto-positions those fixups next to their targets for clean squashing.
Set at repo scope with `git config pull.rebase true` (or `--global` for all repos).
When you need only specific commits (e.g., a hotfix) without bringing other work, to keep a minimal, controlled change set.
`--signoff` appends a DCO sign-off line to the commit message.
`git reflog` shows previous HEAD positions. Identify the lost commit or pre-rebase state and `git reset --hard <hash>` or create a new branch from it to recover.
Tag fixups (`fixup! subject`) then run interactive rebase with `--autosquash`.
Rebase replays commits from your branch onto a new base, creating new commit IDs and a linear history. It’s a rewrite; the old commits are replaced by equivalent ones atop the target base.
Resolve conflicts, `git add`, then `--continue`; use `--abort` to return to pre-rebase state.
`A..B` applies commits reachable from B but not A (lower bound exclusive).