gita
gita copied to clipboard
Command for cloning a git repo and adding it to a group
I would like to do something like this:
gita clone -g Foo [email protected]:nosarthur/gita.git
The result would be the same as:
git clone [email protected]:nosarthur/gita.git
gita add -g Foo ./gita
I think it's a good idea
If i understand this correctly,
- 'gita clone' pulls from a config file rather than a single repo path
- 'gita add' adds an already cloned repo to the tracking but does not clone
the requested feature is a mix of both - clone a single repo, then add it.
So, change the 'clone' command to work with a single repo? Or change the 'add' command to allow cloning? Or, something else?
perhaps:
gita add -g Foo -u [email protected]:nosarthur/gita.git
-u meaning clone from url This would equivalent to:
git clone [email protected]:nosarthur/gita.git
gita add -g Foo ./gita
and
gita clone -g Foo config_file
clone all items from config_file and add to group Foo. (not what the poster asked, but along a similar idea) This would equilavent as something like
for url, name, path in config_file:
git clone url name
gita add -g Foo name
Alternatively, maybe a more radical change?
merge clone and add:
'gita add -c config_file'
same as 'gita clone config_file'
'gita add -c config_file -p'
same as 'gita clone config_file -p'
'gita add -c config_file -g group'
add all items from config_file and track in group [new]
'gita add -u url'
clone repo from url, add to tracking without group [new]
'gita add -u url -g group'
clone repo from url, add to group [new[ <=== requested item
all other 'gita add' remain as they currently are. 'gita clone' could be aliased and deprecated.
Thanks @ackermanaviation for putting the thought. The gita clone
command is indeed not well planned.
I prefer to leave gita add
as it is since it already has too many options. And clean up gita clone
instead. We should make it more like git clone
, just like all the other gita
commands, i.e.,
gita clone <url>
becomes
git clone <url>
at the current working directory.
Then we can add some options, say -C
for where to clone to, -a
for adding it to gita (gita add <cloned-repo-path>
), -g
for adding it to gita and also to a group, -f
for using a config file (the current usage case), etc.
gita clone
refactoring is partially done in v0.16.2, -a
and -g
are still not implemented
https://github.com/nosarthur/gita/releases/tag/v0.16.2
implemented in v0.16.6.1