RaidenF
RaidenF

Reputation: 3531

Get a git repository as a seed (without planning to contribute)

We have a git repository on github. We can download it, or clone it. If it is cloned, you also get all of its history, as well as its branches and some settings (like remotes set to github).

That's all great if it's your project, or you want to contribute via PR, but if you just want the code as a starting point for your project, and do not need updates later on (thus no merges), you do not need a reference to that remote. You also don't need the history etc.

In order to ignore the history, git has the --depth 1 argument to git clone.

What I'm looking for, is a way to "download" a repository to use as a seed, without having setup anything git related (that I might forget to change afterwards). I also want to do it from the command line, not with the download button on github and then extracting (mostly because it's faster).

Is that possible?

Upvotes: 0

Views: 192

Answers (1)

ElpieKay
ElpieKay

Reputation: 30868

Taking the Github repository https://github.com/android/tools_repo for example, in order to download the latest version of the master branch:

curl -LOk https://github.com/android/tools_repo/archive/master.zip && unzip master.zip

After the command runs successfully, you'll find a folder tools_repo-master in the current directory. It's not a git repository but contains the latest code only.

Upvotes: 2

Related Questions