Re: Proposal: create meaningful aliases for git reset's hard/soft/mixed
- From
Phil Hord <phil.hord@gmail.com>
- Date
- Dec 2, 2011, 15:38 UTC
- Message-ID
- <CABURp0pmnsgE1ywW-W2+QFNci=3Lm=JKj9Y3U8zjh8+Cg_NA6Q@mail.gmail.com>
- In-Reply-To
- <CAGK7Mr7zdstbm7QsrYq9a6m9ui_r8Ak8XtyWADLQ0n-mXiov4w@mail.gmail.com>
On Fri, Dec 2, 2011 at 9:27 AM, Philippe Vaucher <philippe.vaucher@gmail.com> wrote:
Show 13 quoted lines
> Maybe we'd start by listing the features we want to be able to do: > > - Move git's HEAD to a particular commit without touching the files or the index > - Move git's HEAD to a particular commit and clear the index but > without touching the files > - Move git's HEAD to a particular commit and clear the index and have > all the files match that particular commit files > - Move git's HEAD to a particular commit and clear the index and have > all the files match that particular commit files and remove files that > are unknown to that commit > > Is there a scenario I'm missing? Once we have the scenarios nailed > down we can start thinking about how to express them.
Aim higher.
Do not think about the git-reset command and all of its features. Moreover, do not limit yourself to git-reset's functionality.
Think about why you need to use git-reset. Why do new users need to use git-reset? What is it they are after?
For me, it was the three I mentioned before.
So, let's look at yours:
> - Move git's HEAD to a particular commit without touching the files or the index
I know what this is, but I don't know to describe it without saying "reset". It's like teleportation. "Move me to a new location in the tree". git teleport <commit>
> - Move git's HEAD to a particular commit and clear the index but > without touching the files
git teleport --index <commit>
> - Move git's HEAD to a particular commit and clear the index and have > all the files match that particular commit files
git checkout --clean <commit>
> - Move git's HEAD to a particular commit and clear the index and have > all the files match that particular commit files and remove files that > are unknown to that commit
git checkout --clean <commit> && git clean -fd # maybe this needs a switch?
One you left out is this: - Do NOT move git's HEAD; clear the index and workdir
git reset
I think the ability to move git's HEAD is what makes reset dangerous, especially in the hands of new users.
Phil