Git fast forward merge is the same as a git reset --hard

Viewed 189

Is this statement about git true, that a merge (where fast forward is possible) is basically the same as making a git reset --hard to HEAD of the branch to merge into?

(When merge is not fast-forward, it's clear that this statement is not true)

1 Answers

Yes, as long as you do not have uncommited changes. If you have, git reset --hard will discard those changes, whereas a fast forward merge will not. A reset without the --hard argument will behave the same as a fast forward merge.

What a fast foward merge does, from git scm:

When the merge resolves as a fast-forward, only update the branch pointer[...]

What reset --hard does (also from git scm):

Reset current HEAD to the specified state

Related