* git reset <tree-ish> <paths> of addition of a submodule?
@ 2017-11-30 17:05 David Turner
2017-11-30 17:10 ` David Turner
0 siblings, 1 reply; 2+ messages in thread
From: David Turner @ 2017-11-30 17:05 UTC (permalink / raw)
To: git
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?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: git reset <tree-ish> <paths> of addition of a submodule?
2017-11-30 17:05 git reset <tree-ish> <paths> of addition of a submodule? David Turner
@ 2017-11-30 17:10 ` David Turner
0 siblings, 0 replies; 2+ messages in thread
From: David Turner @ 2017-11-30 17:10 UTC (permalink / raw)
To: git
On Thu, 2017-11-30 at 12:05 -0500, David Turner wrote:
> 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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-11-30 17:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-30 17:05 git reset <tree-ish> <paths> of addition of a submodule? David Turner
2017-11-30 17:10 ` David Turner
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).