Re: Why not git reset --hard <path>?
- From
Theodore Ts'o <tytso@mit.edu>
- Date
- Sep 28, 2015, 21:36 UTC
- Message-ID
- <20150928213601.GA4071@thunk.org>
- In-Reply-To
- <xmqqvbaub5s4.fsf@gitster.mtv.corp.google.com>
I personally have in my .gitconfig:
[alias] revert-file = checkout HEAD --
I'm not sure revert-file is the best name, but it's what I've used because I've been contaminated by the concept/naming of "p4 revert", which I do use a fair amount to undo local edits for one or more files when I've been forced to use perforce or perforce-like systems. Given that it confuses the concept of how "git revert" works, maybe something like "git unedit <pathspec>" would work better.
Given though it's so easy to address this with a single line in a user's .gitconfig, I guess the question is whether it's worthwhile to make a change that would be visible to all users, and perhaps more importantly, all new users to git.
- Ted