git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reset: allow "-" short hand for previous commit
@ 2015-03-03 20:51 Sudhanshu Shekhar
  2015-03-03 22:10 ` Matthieu Moy
  0 siblings, 1 reply; 12+ messages in thread
From: Sudhanshu Shekhar @ 2015-03-03 20:51 UTC (permalink / raw)
  To: git; +Cc: SudShekhar

From: SudShekhar <sudshekhar02@gmail.com>

Teach reset the same shorthand as checkout and merge. "-" means the
"previous commit".

Signed-off-by: Sudhanshu Shekhar <sudshekhar02@gmail.com>
---
This is done as a microproject for gsoc purposes. I am looking forward to your feedback/comments. Thanks
builtin/reset.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/builtin/reset.c b/builtin/reset.c
index 4c08ddc..3e0378b 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -205,6 +205,8 @@ static void parse_args(struct pathspec *pathspec,
 	 */
 
 	if (argv[0]) {
+		if(!strcmp(argv[0],"-"))
+			argv[0]="@{-1}";
 		if (!strcmp(argv[0], "--")) {
 			argv++; /* reset to HEAD, possibly with paths */
 		} else if (argv[1] && !strcmp(argv[1], "--")) {
-- 
2.3.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-03-08 18:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 20:51 [PATCH] reset: allow "-" short hand for previous commit Sudhanshu Shekhar
2015-03-03 22:10 ` Matthieu Moy
2015-03-03 23:17   ` Junio C Hamano
2015-03-04  7:07     ` Sudhanshu Shekhar
2015-03-04  7:09       ` Sudhanshu Shekhar
2015-03-04  7:10       ` Eric Sunshine
2015-03-05  0:34       ` Junio C Hamano
2015-03-07 21:04         ` [PATCH 1/2] " Sudhanshu Shekhar
2015-03-08 10:33           ` Matthieu Moy
2015-03-08 14:58             ` [PATCH 1/2] Teach reset the same short-hand as checkout Sudhanshu Shekhar
2015-03-08 14:58               ` [PATCH 2/2] Added test cases for git reset - Sudhanshu Shekhar
2015-03-08 18:09                 ` David Aguilar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).