git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git reset <tree-ish> <paths> of addition of a submodule?

From
David Turner <novalis@novalis.org>
Date
Nov 30, 2017, 17:10 UTC
Message-ID
<1512061858.9882.375.camel@novalis.org>
In-Reply-To
<1512061507.9882.374.camel@novalis.org>
On Thu, 2017-11-30 at 12:05 -0500, David Turner wrote:
Show 17 quoted lines
> git submodule add https://my-git-repo blort
> git commit -m 'add a submodule'
> git reset HEAD^ blort
> 
> The reset deletes the gitlink, but does not delete the entry in
> .gitmodules.  On one hand, this is exactly what the user asked for --
> they wanted the path 'blort' to be changed in the index, and that's
> what they got.  On the other hand, the behavior differs from git rm,
> and seems confusing: most folks don't want an entry in .gitmodules
> which doesn't correspond to a gitlink.  
> 
> If reset isn't the right thing for me to do when I want to say "oops"
> about adding a submodule, then what is?  I could do:
> git reset HEAD^ blort .gitmodules
> but what if I added two submodules and only wanted to undo the
> addition
> of one?

Also, resetting the deletion of a submodule has an even worse issue -- you end up with a gitlink but no entry in .gitmodules.

Previous: David Turner
Message 2 of 2 in “git reset <tree-ish> <paths> of addition of a submodule?”
  1. David TurnerNov 30, 2017
  2. David TurnerNov 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.