reset-recoverable-head
branch
main reset 2 commits back; former tip recoverable via main@{1}
Description
`main` was at 4 commits, then hard-reset back to the 2nd commit.
The former tip (commit 4) and its parent (commit 3) are not on any
branch but remain in the object store, recoverable via the reflog:
`git checkout main@{1}` or `git reset --hard main@{1}`
Useful for testing:
- "undo reset" / recovery affordances in TUIs
- reflog browsing and "restore branch tip" flows
- HEAD divergence visualisation after a hard reset Contracts
- main has 2 commits
- worktree is clean
- the former tip (4th commit) is not reachable from main
- the former tip is recoverable via main@{1} in the reflog
Tags
Branches
main Use it
import { spinUpScenario } from '@gfargo/git-scenarios'
const repo = await spinUpScenario('reset-recoverable-head') npx git-scenarios create reset-recoverable-head import { describeWithScenario } from '@gfargo/git-scenarios/jest'
describeWithScenario('reset-recoverable-head', (getRepo) => {
it('should have the expected state', async () => {
const repo = getRepo()
// your assertions here
})
}) Commit graph
* 1ab1c9c (HEAD -> main) feat: one
* 7520170 chore: initial