Skip to content
History

Moving the branch

Reset's three modes are three different commands sharing a name.

`git reset` moves the branch you are on. What else it touches depends on the mode, and the three modes map exactly onto the three trees.

`--soft` moves the branch and nothing else, so everything the commits contained is still staged. `--mixed`, the default, also rewrites the index, turning that work into unstaged changes. `--hard` additionally overwrites your files, and is the only one that destroys anything.

In every case the commits you moved away from still exist and the reflog still names them. `--hard` is dangerous because of your uncommitted work, not because of the commits.

Commands in this lesson

git reset
Move the current branch, and depending on the mode the index and files too
No account, no backend. Everything you do stays in this browser.liter8.sh