{"thread":{"id":"47356","subject":"git reset <tree-ish> <paths> of addition of a submodule?","startedAt":"2017-11-30T17:05:13Z","lastAt":"2017-11-30T17:11:04Z","messageCount":2,"participants":["David Turner"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"333857","messageId":"1512061507.9882.374.camel@novalis.org","threadId":"47356","inReplyTo":null,"subject":"git reset <tree-ish> <paths> of addition of a submodule?","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2017-11-30T17:05:07Z","receivedAt":"2017-11-30T17:05:13Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"git submodule add https://my-git-repo blort\ngit commit -m 'add a submodule'\ngit reset HEAD^ blort\n\nThe reset deletes the gitlink, but does not delete the entry in\n.gitmodules.  On one hand, this is exactly what the user asked for --\nthey wanted the path 'blort' to be changed in the index, and that's\nwhat they got.  On the other hand, the behavior differs from git rm,\nand seems confusing: most folks don't want an entry in .gitmodules\nwhich doesn't correspond to a gitlink.  \n\nIf reset isn't the right thing for me to do when I want to say \"oops\"\nabout adding a submodule, then what is?  I could do:\ngit reset HEAD^ blort .gitmodules\nbut what if I added two submodules and only wanted to undo the addition\nof one?\n\n\n"},{"id":"333858","messageId":"1512061858.9882.375.camel@novalis.org","threadId":"47356","inReplyTo":"1512061507.9882.374.camel@novalis.org","subject":"Re: git reset <tree-ish> <paths> of addition of a submodule?","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2017-11-30T17:10:58Z","receivedAt":"2017-11-30T17:11:04Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"On Thu, 2017-11-30 at 12:05 -0500, David Turner wrote:\n> git submodule add https://my-git-repo blort\n> git commit -m 'add a submodule'\n> git reset HEAD^ blort\n> \n> The reset deletes the gitlink, but does not delete the entry in\n> .gitmodules.  On one hand, this is exactly what the user asked for --\n> they wanted the path 'blort' to be changed in the index, and that's\n> what they got.  On the other hand, the behavior differs from git rm,\n> and seems confusing: most folks don't want an entry in .gitmodules\n> which doesn't correspond to a gitlink.  \n> \n> If reset isn't the right thing for me to do when I want to say \"oops\"\n> about adding a submodule, then what is?  I could do:\n> git reset HEAD^ blort .gitmodules\n> but what if I added two submodules and only wanted to undo the\n> addition\n> of one?\n\n\nAlso, resetting the deletion of a submodule has an even worse issue --\nyou end up with a gitlink but no entry in .gitmodules.\n\n"}]}