Stefan
Stefan

Reputation: 28541

How to do a "git fast-backward"?

When I do a "fast-forward" merge, my current branch is updated to a new commit, and the corresponding changes are applied to my current worktree (and merged with the current uncommitted changes).

I'd like to do the same, but moving to a commit that is backward in time instead of forward.

I know how to navigate backward in time with git checkout, but that disconnects my worktree with its branch, which is not what I want to do. The closest I found is git reset which does change my branch like I want it, but I can't figure out how to make it merge the currently uncommitted changes: with --merge, currently staged changes seem to be lost (!) rather than merged.

Upvotes: 0

Views: 139

Answers (1)

Mark Adelsberger
Mark Adelsberger

Reputation: 45749

I think the best you'll do is to stash your changes, reset, and then apply the stash.

Upvotes: 1

Related Questions