1

I would like to clone a subfolder of this project https://github.com/veista/smartthings namely smartthings/custom_components/smartthings however all the answers of related questions keep the repo structure: my-dir/smartthings/custom_components/smartthings and I would like the following result: my-dir/smartthings(the subfolder, not the repo root)

Is it possible?

2
  • Cloning is something you do to a repository. Files are part of the working directory. Are you trying to check out a copy of a folder? Do you need to preserve the history and be able to commit back? Can you explain your requirements and expectations, and show how the things you tried did not meet them? Commented Dec 20, 2021 at 23:25
  • If it's not possible with the actual code, you could Fork the repository to edit the existing code with your own logic (and possibly add a feature to configure and send a pull request) Commented Dec 21, 2021 at 0:44

2 Answers 2

1

If you're on some soda-straw connection or paying by the byte or something, you can also use the filtering support the main Git hosting services support and Git's core commands,

git clone -n --filter=tree:0 https://github.com/veista/smartthings
cd smartthings
git read-tree -um @:custom_components/smartthings

and to check out another commit you do git reset --soft $thatcommit; git read-tree -um @:custom_components/smartthings. Everything else can be worked around in similar fashion.

This is really not how Git's built to operate. In any real use it is vastly more efficient to just fetch the damn repo. This repo you only want a piece of is 508KB including the checkout; it's a 188KB download. The page load for checking answers to your question exceeds the sum total of all the data traffic you could save with this, to say nothing of the human time and effort spent on the task.

Sign up to request clarification or add additional context in comments.

Comments

0

You can:

That is:

cd local/cloned/repo
git filter-repo --path custom_components/smartthings/ --path-rename custom_components/smartthings/:/
git remote set-url origin https://github.com/<me>/<newRepo>
git push

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.