...
The style of reset you apply makes a huge difference in the result.
--soft
Does not touch the index file nor the working tree at all (but resets the head to <commit>)
(This is great for "squashing" several commits together as they're changes are on disk and they're in the staging area (index) ready to be committed.)
--mixed
Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. This is the default action.
(This is useful when you're accidentally added too much to the staging area and just want to reset it)
--hard
Resets the index and working tree. Any changes to tracked files in the working tree since <commit> are discarded. ( The Nuclear option. This is going to reset everything to be that commit. Great for when you just want to basically recreate a branch. The following will reset a branch to be the one on the Pentaho repository
Code Block |
---|
git fetch upstream |
...
git reset --hard upstream/master |
--merge and --keep
These are inbetween a --hard and --soft. I don't use them much, but you can read about them here (https://www.kernel.org/pub/software/scm/git/docs/git-reset.html)
...