https://github.com/0xtadash1/sparsity-submodule
https://github.com/0xtadash1/sparsity-submodule
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/0xtadash1/sparsity-submodule
- Owner: 0xTadash1
- Created: 2023-02-02T11:54:19.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-04T15:31:38.000Z (over 2 years ago)
- Last Synced: 2024-01-22T23:26:08.441Z (over 1 year ago)
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sparsity Submodule
My practice on the combination of git `submodule` & `sparse-checkout`.
How to bring any directory/file from a foreign repository.## At First (setup)
At here, I would like to use `{test/,tool/}` from `munificent/craftinginterpreters`.
```sh
git clone --depth=1 --filter=blob:none --sparse \
https://github.com/munificent/craftinginterpreters.git \
test/craftinginterpretersgit submodule add \
https://github.com/munificent/craftinginterpreters.git \
test/craftinginterpreters# Move `test/craftinginterpreters/.git/` to `.git/`
git submodule absorbgitdirs
#
# > A repository that was cloned independently and later added as
# > a submodule or old setups have the submodules git directory
# > inside the submodule instead of embedded into the
# > superprojects git directory.
#
# --git -C test/craftinginterpreters sparse-checkout set test/ tool/
```## After the Second time (clone)
```sh
# Nogit clone --recursive https://github.com/0xTadash1/sparsity-submodule
# Instead
git clone https://github.com/0xTadash1/sparsity-submodule
git submodule init
git clone --depth=1 --filter=blob:none --sparse \
https://github.com/munificent/craftinginterpreters.git \
test/craftinginterpreters
git submodule absorbgitdirs
git -C test/craftinginterpreters sparse-checkout set test/ tool/
```## `git submodule absorbgitdirs`
After `git submodule deinit`, we can `checkout` the sparsity submodules again by simply
`git submodule update --init --filter=blob:none --depth=1 test/craftinginterpreters`.This is because `git submodule absorbgitdirs` records the `sparse-checkout` configuration
under `.git/` in the superprojects.## cf.
-
-