{"thread":{"id":"1449","subject":"[PATCH] Stash away the original head in ORIG_HEAD when resetting.","startedAt":"2005-08-08T06:06:56Z","lastAt":"2005-08-09T02:48:13Z","messageCount":4,"participants":["Junio C Hamano","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"6922","messageId":"7vy87dgdxb.fsf@assigned-by-dhcp.cox.net","threadId":"1449","inReplyTo":null,"subject":"[PATCH] Stash away the original head in ORIG_HEAD when resetting.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-08T06:06:56Z","receivedAt":"2005-08-08T06:06:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"When rewinding the head, stash away the value of the original\nHEAD in ORIG_HEAD, just like git-resolve-script does.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\nSince rewinding the head is a dangerous operation, saving it\nsomewhere just in case would make life a bit safer.  This also\nlets you do:\n\n    $ git commit\n    ... \"oops, I forgot to include that fix.\"\n    $ git reset HEAD^1\n    ... edit away and update-cache\n    $ git commit -m ORIG_HEAD\n\nto reuse the old commit message.\n\n git-reset-script |    8 +++++++-\n 1 files changed, 7 insertions(+), 1 deletions(-)\n\n87aced8864d926cf870ddfb2ca7ac5784fccb911\ndiff --git a/git-reset-script b/git-reset-script\n--- a/git-reset-script\n+++ b/git-reset-script\n@@ -2,6 +2,12 @@\n . git-sh-setup-script || die \"Not a git archive\"\n rev=$(git-rev-parse --revs-only --verify --default HEAD \"$@\") || exit\n rev=$(git-rev-parse --revs-only --verify $rev^0) || exit\n-git-read-tree --reset \"$rev\" && echo \"$rev\" > \"$GIT_DIR/HEAD\"\n+git-read-tree --reset \"$rev\" && {\n+\tif orig=$(git-rev-parse --verify HEAD 2>/dev/null)\n+\tthen\n+\t\techo \"$orig\" >\"$GIT_DIR/ORIG_HEAD\"\n+\tfi\n+\techo \"$rev\" > \"$GIT_DIR/HEAD\"\n+}\n git-update-cache --refresh\n rm -f \"$GIT_DIR/MERGE_HEAD\"\n"},{"id":"6929","messageId":"Pine.LNX.4.63.0508081111020.26210@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1449","inReplyTo":"7vy87dgdxb.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Stash away the original head in ORIG_HEAD when resetting.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-08T09:13:26Z","receivedAt":"2005-08-08T09:13:26Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 7 Aug 2005, Junio C Hamano wrote:\n\n>     $ git commit -m ORIG_HEAD\n\nSince there are not many users of git-commit's *-m* flag right now: Is it \nnecessary to confuse CVS people, who expect to be able to write\n\n\tgit commit -m \"I did this and that\"\n\nI do not want to be too intrusive, but I think up to now there is just the \nmailbox tools which use this feature, and users of git-reset. Thoughts?\n\nCiao,\nDscho\n"},{"id":"6930","messageId":"Pine.LNX.4.63.0508081122030.31438@wgmdd8.biozentrum.uni-wuerzburg.de","threadId":"1449","inReplyTo":"Pine.LNX.4.63.0508081111020.26210@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Stash away the original head in ORIG_HEAD when resetting.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-08-08T09:22:27Z","receivedAt":"2005-08-08T09:22:27Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 8 Aug 2005, Johannes Schindelin wrote:\n\n> Hi,\n> \n> On Sun, 7 Aug 2005, Junio C Hamano wrote:\n> \n> >     $ git commit -m ORIG_HEAD\n> \n> Since there are not many users of git-commit's *-m* flag right now: Is it \n> necessary to confuse CVS people, who expect to be able to write\n> \n> \tgit commit -m \"I did this and that\"\n> \n> I do not want to be too intrusive, but I think up to now there is just the \n> mailbox tools which use this feature, and users of git-reset. Thoughts?\n\nSorry, forgot -rebase and -cherry.\n\nCiao,\nDscho\n"},{"id":"6973","messageId":"7v7jevzuz6.fsf@assigned-by-dhcp.cox.net","threadId":"1449","inReplyTo":"Pine.LNX.4.63.0508081111020.26210@wgmdd8.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] Stash away the original head in ORIG_HEAD when resetting.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-09T02:48:13Z","receivedAt":"2005-08-09T02:48:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Since there are not many users of git-commit's *-m* flag right now: Is it \n> necessary to confuse CVS people, who expect to be able to write\n>\n> \tgit commit -m \"I did this and that\"\n>\n> I do not want to be too intrusive, but I think up to now there is just the \n> mailbox tools which use this feature, and users of git-reset. Thoughts?\n\nI could be talked into renaming the option to something else and\nusing -m in a way that is CVS compatible.\n\nThat flag originally came from JIT, which uses:\n\n  -M <commit>\tliterally take the commit message, no editing necessary;\n  -m <commit>\tstart with commit message in this one but have user edit;\n\n  -l <file>\tuse the log message in this file;\n  -l -\t\tread the log message from stdin.\n"}]}