{"thread":{"id":"16975","subject":"git reset --hard <commit> superfluous?","startedAt":"2009-01-03T01:13:19Z","lastAt":"2009-01-03T12:20:01Z","messageCount":3,"participants":["chris@seberino.org","Sitaram Chamarty","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"99237","messageId":"20090103011319.GA24149@seberino.org","threadId":"16975","inReplyTo":null,"subject":"git reset --hard <commit> superfluous?","fromName":"","fromEmail":"chris@seberino.org","sentAt":"2009-01-03T01:13:19Z","receivedAt":"2009-01-03T01:13:19Z","isPatch":false,"sender":{"key":"chris@seberino.org","avatar":null},"body":"David\n\ngit reset --hard <commit>\n\"resets\" the current branch head.\n\nIs this equivalent to deleting the branch\nand doing\n\ngit branch <branch> <commit> ??\n\nSo \"git reset --hard\" is syntactic sugar and 'unnecessary' right?\n\ncs\n"},{"id":"99242","messageId":"slrnglu1ms.63u.sitaramc@sitaramc.homelinux.net","threadId":"16975","inReplyTo":"20090103011319.GA24149@seberino.org","subject":"Re: git reset --hard <commit> superfluous?","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-01-03T06:34:04Z","receivedAt":"2009-01-03T06:34:04Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On 2009-01-03, chris@seberino.org <chris@seberino.org> wrote:\n> git reset --hard <commit>\n> \"resets\" the current branch head.\n>\n> Is this equivalent to deleting the branch\n> and doing\n>\n> git branch <branch> <commit> ??\n>\n> So \"git reset --hard\" is syntactic sugar and 'unnecessary' right?\n\nonly if you don't have any local changes to the work tree or\nthe index :-)\n\nIf you do, however, the reset throws them away, while the\nlonger method tries to preserves them, to the point of not\nletting you switch if there are too many changes.\n"},{"id":"99249","messageId":"20090103122001.GA20199@atjola.homenet","threadId":"16975","inReplyTo":"20090103011319.GA24149@seberino.org","subject":"Re: git reset --hard <commit> superfluous?","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2009-01-03T12:20:01Z","receivedAt":"2009-01-03T12:20:01Z","isPatch":false,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2009.01.02 17:13:19 -0800, chris@seberino.org wrote:\n> David\n> \n> git reset --hard <commit>\n> \"resets\" the current branch head.\n> \n> Is this equivalent to deleting the branch\n> and doing\n> \n> git branch <branch> <commit> ??\n> \n> So \"git reset --hard\" is syntactic sugar and 'unnecessary' right?\n\nDeleting the branch also deletes the reflog, while using reset adds a\nnew entry to the reflog. So returning the branch head to its previous\nstate is pretty trivial if you used reset and might be pretty hard if\nyou deleted the branch. HEAD's reflog should probably have the right\nentry as well, but chances are that it's hidden in a crapload of other\nentries, especially if you rebase often.\n\nBjörn\n"}]}