A critical fix on `main` must go to the `release/4.1` branch only.
BeginnerScenarioRebase, Cherry-pick and History Rewriting
Answer
Situation read → You need one commit, not a merge of all of main.
What I'd do →
git switch release/4.1.git cherry-pick -x <sha>.- Run the release pipeline, then push or open a PR.
Why → Cherry-pick re-applies the diff as a new commit; -x records the original SHA in the message for traceability.
Interview tip → Fix on main first so the fix is never lost in the next release.
More on Rebase, Cherry-pick and History Rewriting
Your PR branch has ten commits like "wip", "fix typo", "oops". How do you clean it up before review?BeginnerYou want the database migration commit to come before the code that uses it.BeginnerYou must backport a feature made of 6 commits, including one merge commit.IntermediateBranch B was built on top of branch A. A was squash-merged into `main`, and now B shows A's commits again.IntermediateDuring review you get ten small change requests on old commits. How do you apply them cleanly?IntermediateDuring a rebase, "ours" and "theirs" seem backwards. Why?Intermediate