Git merge into target branch
Land means: target receives a merge of the branch you started on (source), then you return to source.
target = branch name from this message (trimmed). If missing or ambiguous, ask once and stop.
Steps
source =git branch --show-current. Ifsourceequalstarget, report and stop.git status --short. Uncommitted changes → stop; do not stash/discard unless told in this message.git fetch --allwhen network is allowed (else use existing refs and say so).- Resolve
target:- Local exists → use it
- Else
origin/targetexists →git switch -c target --track origin/target(orgit switch targetif Git creates the tracking branch) - Else → report missing; stop (do not invent branches)
git switch targetthengit merge source(repo defaults for ff/merge).- Conflicts → list files, stay on
target, stop for manual resolve/abort. - After a clean merge: push
target(git push, orgit push -u origin <target>if no upstream). Push failure or no remote → stay ontarget, report; switch back only after push succeeds or the user says to skip push and switch back. - After push succeeds:
git switch source. - Done when:
targetcontains the merge, push succeeded (or skip authorized), and HEAD is back onsource— or you stopped at a hard stop above.
Guardrails
- Do not push
sourceor other branches unless this message asks. - No rebase,
--force, orreset --hardunless explicitly requested.