7 releases
0.1.33 | Aug 18, 2023 |
---|---|
0.1.32 | Aug 13, 2023 |
0.1.1 | Jul 30, 2023 |
#218 in Filesystem
22KB
306 lines
gimic
Mimic Git with added functionality
Nested repo code updates
repo 1 <Main_repo>
|
|- /some/cool/file/from/repo2
Easily manage specific files/directories from other repos "remotely".
Installation:
Make sure you have git
installed, and your working in a git repo
-
Build from source
i. After downloading the source code, run
cargo build --release
ii. [Optional] Add file location of the release to system
PATH
How it works:
Gimic was designed to miMIC GIt, where although submodules
and subtree
are great options for including another repo into your project, you may want a little bit more granular control of what file(s) are actually pulled in and are sitting in your local directory/workspace. Using gimic
only affects your repo where the file will appear untracked (as any new file would) so it may be a good idea to update your .gitignore file or .git/exclude
Configuration:
Create a gloc.yaml file in the root of your poject
- Checkout the example configuration file to get an idea
repo 1
|
|-gloc.yaml
If you applied installation step 2.ii, this can be run anywhere within a nested .git directory, otherwise the target build directory will need to exist within the desired "root" repo.
Usage:
$ gimic checkout
-
This is is just a wrapper around
git pull
andcp <source> <to>
. Specifying just the action only , ie.checkout
, and no other args means that a yaml file configuration exists somehwere in the execution path (ie. the place where you've calledgimic
) and that when the alternate_repo is pulled down, the files will be copied from thealternate_source
to thealternate_target
. Note that at least one of the locations needs to exists, and if only one of either option does exists, this will be the default for the other option. Meaning (super simple psudo-ish code Rust)!alternate_source { alternate_target = alternate_source } (and vice versa)
. NOTE: This is currently not enforced, but will be in later versions. -
File copying resembles, like Linux, where target "type" is based off of "source" type. Meaning if "source" ie (
alternate_source
) is a file, "target" will be a file (regardless if it contains a designated extension). But if "source" is a directory, then target will be a direct( even IF it has a file designation). Another thing to note is that recursive file creation is standard with thecheckout
command. Similar tomkdir -R
in Linux -
When gimic's checkout process completes. The temporary repo( aka.
alternate_repo
) is removed, unless otherwise specified within gloc.yaml configuration
$ gimic --[no-]skip-worktree target_dir
- Because
git update-index --skip-worktree <some_file>
does not handle directories, rather than needing to create some wicked one line code snippet, you can turn on/off the git's tracking (temporarily like original command)
Potential Changes
- Allow existence gloc.yaml file to be optional
- Allow downloadable prebuilt binaries for popular systems
- Proivde option to merge/rebase current file/files
- Allow multiple targets
- Incorporate commit and pushes
- commits would require directory perisistence..
- allow skip worktree to specifcy alternate location
Contributions
Feel free to commment in the repo and let me know if you have any other suggestions or want to contribute!
Dependencies
~5–14MB
~168K SLoC