rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
52.82k stars 10.03k forks source link

[question] how to add repo as submodule? #1989

Closed yozachar closed 3 months ago

yozachar commented 3 months ago

Hi,

I'm practicing Rust, I hope to practice other languages too. So I created https://github.com/yozachar/practice, add tried to add rustlings as a git submodule. But I'm facing some trouble.

  1. When I do git submodule add -b 5.6.1 --depth 1 gh:rust-lang/rustlings, I see
    fatal: 'origin/5.6.1' is not a commit and a branch '5.6.1' cannot be created from it
    fatal: unable to checkout submodule 'rustlings'

    I guess that's because no such branch exists on this repository.

  2. So I did
    $ git submodule add gh:rust-lang/rustlings
    $ cd rustlings
    $ git checkout 5.6.1
    $ cargo install --locked --force --path .
    $ cd ..
    $ git add rustlings
    $ git commit && git push

    but I get a 404: https://github.com/yozachar/practice/blob/main/rustlings.

Why? How can I see my rustling progress on that GitHub repository as a submodule?

mo8it commented 3 months ago

As far as I can see in your repo, you were able to do it :)

yozachar commented 3 months ago

Not exactly no. Sub-modules didn't work the way I thought it would, if I add commits, it does not reflect on GitHub, cause I can't push them here (to rustlings repo).

Anyway I ended up adding rustlings clone as a whole folder.