1. You made a fixup commit with message `fixup! Parse config`. Which command auto-positions it during rebase?
`--autosquash` pairs `fixup!`/`squash!` commits with their targets in the todo list.
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
Branching Strategies & Merge vs Rebase — History Hygiene interview questions for placements and exams.
Questions
14
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.
`--autosquash` pairs `fixup!`/`squash!` commits with their targets in the todo list.
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.
Enable with `git config rerere.enabled true` to speed repeated merges/rebases with identical conflicts.
Rebase copies your commits onto the target tip (new IDs), producing a straight line; merge records a join, keeping parallel history.
`--no-ff` creates a merge commit even if HEAD could fast-forward, keeping branch context for later tracing/reverts.
Run `git rebase -i HEAD~3`; change second/third `pick` to `squash` (or `fixup`); save, then edit the combined message and complete the rebase.
Rebasing rewrites commit IDs, breaking collaborators’ histories. It’s safe on private/local branches before pushing or when everyone coordinates (e.g., force-push with lease) and consumers are ready.
Stage the resolved files and continue. You do not create a manual commit during rebase steps.
Use it to transplant a range of commits onto a different base, skipping earlier ones. Example: move `featureA` commits that diverged from `topic` onto `main`: `git rebase --onto main topic featureA`.
An octopus merge merges more than two branches in a single commit. It’s suitable for merging many independent topic branches without conflicts; avoid when manual conflict resolution is required.
Use `git reflog` to find the pre-rebase HEAD (e.g., `HEAD@{1}`) and `git reset --hard <that-id>` or create a rescue branch from it. Reflog records past HEAD positions.
Rebasing avoids merge bubbles, and squashing yields a single, reviewed commit per PR while PR metadata preserves context.
Git Flow favors release cycles (develop, release, hotfix) for products with scheduled releases. GitHub Flow suits continuous delivery with short-lived feature branches and PRs to main. Trunk-based emphasizes committing to main behind flags with tiny branches for rapid integration. Choose based on cadence, compliance, and team size.
Squash merge maintains a clean history with one commit representing the PR.
`-X ours` is a strategy option for the recursive strategy preferring current branch on a path-level conflict; `-s ours` discards the other tree entirely.