Re: reverting vs resetting
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:48:11
Avery Pennarun [off-list ref] writes:
On Fri, Feb 5, 2010 at 1:12 AM, Mihamina Rakotomandimby [off-list ref] wrote:quoted
When we decided to giveup, we decided to get back to the configuration before Bob broke it. But it would be interesting to see Andy's history. Reverting or resetting?Try this: git checkout HEAD~5 . git commit -m "reverted back to the version before this mess"
Caveat: if Andy added new paths while experimenting, the above won't
remove it. You would need something like this instead:
git read-tree -m -u HEAD~50
git commit -m "reverted back to the version before this mess"
But this all assumes that the futile experiment is worth keeping. I
highly doubt it.
I would recommend to do this:
git branch andy_failed_experiment
git reset --hard HEAD~50
;# and perhaps revert Bob's change here as well
There is no sane reason to keep the failed experiment that added nothing
of value to the history leading to the tip of the 'master' branch.
I am using the word _value_ but keep in mind that value is relative to the
purpose you have in mind. The purpose of the 'master' branch presumably
is to keep and to improve on a working configuration of the gateway box.
For that particular purpose, you have to admit that Andy's futzing around
didn't add anything of value in the result. Hence, that shouldn't be kept
in its history.
Andy and other people may be able to learn from the failed experiment
later, so it is perfectly Ok to keep the series of random hacks in a
separate branch to study at their leisure. The purpose of the branch is
different from that of the 'master': it is to serve as a catalog of
things/ideas that did _not_ work.