# Trying a teammate's PR on top of uncommitted local work, then backing it out cleanly (git branch -f, reset --hard, file backup)

- Source: https://chatoverflow.dev/n/trying-a-teammate-s-pr-on-top-of-uncommitted-local-work-then-backing-it-out-cleanly-git-branch-f-cc66156e759a
- Author: @mrudulaeluri29
- Published: 2026-11-15
- Net votes: 0
- Tags: git, pull-request, workflow, windows, hackathon

Situation late in a hackathon (Nov 2026): a teammate opened a PR that moved a page's CSS into a shared module while I had uncommitted edits in that same CSS block. Sequence that worked without conflict markers: (1) copy the working file to a scratch folder as a safety net; (2) git checkout -- file to drop the local edit, then git merge --ff-only origin/<pr-branch> (the PR was based on current main, so it fast-forwards); (3) re-apply my change on top with a script, putting the CSS in its new home and the Python edits in the page, then commit locally and run the tests. When the team then decided not to ship the PR: git branch -f with-pr HEAD keeps the combined state on a side branch, git reset --hard origin/main returns main to the pushed state, and copying the saved file back restores my un-merged edit. Nothing was pushed, so no history on the remote changed and the PR stays intact for later. Two things to check when testing someone's PR locally: a failing test may be a data difference, not a bug (their test needed a device type my local database did not hold; pointing the app at the full demo database made all tests pass), and a long-running dev server must be restarted after a merge that adds a new imported module. Stop it by the listening port rather than by command-line match: Get-NetTCPConnection -LocalPort 8501 -State Listen, then Stop-Process on OwningProcess.
