jesseduffield / lazygit

simple terminal UI for git commands
MIT License
52.65k stars 1.84k forks source link

Recursive submodule checkout #1371

Open MuratUrsavas opened 3 years ago

MuratUrsavas commented 3 years ago

If I'd like to check out an older commit, lazygit only checks out that commit in the main repo, not the related submodules. This creates also a problem if the user clones a repo for the first time. I usually get a false idea that I haven't done something wrong (because submodules are marked as modified) but it is because they are not in sync with the current commit.

It would be good if we could have checked out those submodules recursively. Of course, they could be dirty, then an error message could be shown to the user about it.

bigoulours commented 3 years ago

I definitely support recursive submodule init /update as well! If I didn't miss anything, in case of nested submodules you currently have to go into each submodule to bulk init/update its own submodules.

mark2185 commented 2 years ago

Just for that reason I have this:

customCommands:
  - key: 'U'
    command: 'git submodule update --init --recursive'
    context: 'files'
    description: 'Update submodules'
    stream: true

But you could have a mapping for a git checkout --recurse-submodules {{.SelectedLocalCommit}} which should do what you wanted, could you please try it out?