git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Fwd: error: 'submodule' does not have a commit checked out
       [not found] ` <CAF8BazC1kEV+s7vDSAkqcvjYVTCyDaw8gi0ZHpH7K+3Q4CAczA@mail.gmail.com>
@ 2021-01-11 14:44   ` Aleksey Midenkov
  2021-01-11 15:36     ` Philippe Blain
  0 siblings, 1 reply; 2+ messages in thread
From: Aleksey Midenkov @ 2021-01-11 14:44 UTC (permalink / raw)
  To: Git Mailing List

I used to update last commit with new changes:

git commit --amend .

The project has several submodules:

 e116c89a58af750421d82ece13f80516d2bde02e extra/wolfssl/wolfssl
(v4.3.0-stable-596-ge116c89a5)
a746c3af449a8754e78ad7971e59e79af7957cdb libmariadb (v3.1.3-121-ga746c3a)
b6b02ed516f92055127d416370799d91a82754ea
storage/columnstore/columnstore (columnstore-1.5.3-1-14-gb6b02ed5)
-d172e86c16224b4e0229ca6f102e662a2315aeff storage/maria/libmarias3
-bba5e7bc21093d7cfa765e1280a7c4fdcd284288 storage/rocksdb/rocksdb
-ae4e58ba031587039c8830f2f8ca51fa9fb7d6eb wsrep-lib

Now it fails with this message:

git commit --amend .
error: 'storage/maria/libmarias3' does not have a commit checked out
fatal: updating files failed

How to use amend without specifying explicit paths without
initializing submodules? I don't need to amend submodules and would
prefer them ignored in my commits.

git --version
git version 2.27.0

Works as expected in 2.19.1

--
All the best,

Aleksey Midenkov
@midenok

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Fwd: error: 'submodule' does not have a commit checked out
  2021-01-11 14:44   ` Fwd: error: 'submodule' does not have a commit checked out Aleksey Midenkov
@ 2021-01-11 15:36     ` Philippe Blain
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Blain @ 2021-01-11 15:36 UTC (permalink / raw)
  To: Aleksey Midenkov, Git Mailing List

Hi Aleksey,

Le 2021-01-11 à 09:44, Aleksey Midenkov a écrit :
> I used to update last commit with new changes:
> 
> git commit --amend .
> 
> The project has several submodules:
> 
>   e116c89a58af750421d82ece13f80516d2bde02e extra/wolfssl/wolfssl
> (v4.3.0-stable-596-ge116c89a5)
> a746c3af449a8754e78ad7971e59e79af7957cdb libmariadb (v3.1.3-121-ga746c3a)
> b6b02ed516f92055127d416370799d91a82754ea
> storage/columnstore/columnstore (columnstore-1.5.3-1-14-gb6b02ed5)
> -d172e86c16224b4e0229ca6f102e662a2315aeff storage/maria/libmarias3
> -bba5e7bc21093d7cfa765e1280a7c4fdcd284288 storage/rocksdb/rocksdb
> -ae4e58ba031587039c8830f2f8ca51fa9fb7d6eb wsrep-lib
> 
> Now it fails with this message:
> 
> git commit --amend .
> error: 'storage/maria/libmarias3' does not have a commit checked out
> fatal: updating files failed
> 
> How to use amend without specifying explicit paths without
> initializing submodules? I don't need to amend submodules and would
> prefer them ignored in my commits.
> 
> git --version
> git version 2.27.0
> 
> Works as expected in 2.19.1


I can reproduce the behaviour. It was introduced in f937bc2f86
(add: error appropriately on repository with no commits, 2019-04-09),
in Git 2.22. I think that commit and the rest of that topic,
4ab701b2ee (Merge branch 'km/empty-repo-is-still-a-repo', 2019-05-09),
are sound.

For your use case, if you want to amend the latest commit and include
changes from all tracked files, you can simply do

     git commit --amend --all

or shorter:

     git commit --amend -a

The only difference with what I think you wanted to achieve is that
any *new* files will not be added by '-a', only changes to already tracked
files are included. If you have new files that you also want included, then
you would need to 'git add' them separately.

Reading the doc for 'git commit' [1], it appears that

     git commit --amend --only

would also work if you want to only include changes to files that were
already modified in the commit you are amending. I haven't testes that
though.

Hope that helps,

Philippe.


[1] https://git-scm.com/docs/git-commit

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-11 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CAF8BazBFsR5yQ0M5wscCfE-KuXTGZ=i4-1gP9NZZvjCfAD5NrQ@mail.gmail.com>
     [not found] ` <CAF8BazC1kEV+s7vDSAkqcvjYVTCyDaw8gi0ZHpH7K+3Q4CAczA@mail.gmail.com>
2021-01-11 14:44   ` Fwd: error: 'submodule' does not have a commit checked out Aleksey Midenkov
2021-01-11 15:36     ` Philippe Blain

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).