Stephan van Rooij

Software architect with a passion for home automation.

Clone a BIG git repository

C

Wanted to clone a repository to do a quick text fix and create a pull request. Created the fork, and tried to clone. Cloning the repository took way longer than I’m used to.

Slow git clone

Shallow clone

I heard about shallow clone that supposed to only clone a single branch, and thus keep the clone fast.

git clone [remote-url] --branch [name] --single-branch [folder]

This didn’t work, cloning still took forever.

Clone with filter

Apparently the repository I was cloning, had a lot of large files in it. So I tried using a blob filter, set for 20Kb. Meaning the following command would skip downloading all files larger then 20Kb.

git clone --filter=blob:limit=20k [repo-url]
git clone --filter=blob:limit=20k https://github.com/svrooij/azure-docs.git

This seemed to be the work-around for this problem.

Large files in git (the right way)

The above repository just has all the large files in the repository, which obviously results in extreme long clone times. In 2015 they released git-lfs. This allows you to keep using git, but the large files (that you configured) will no longer be saved in the repository. The git history will just contain a reference to the large file that is saved outside of the repository.

Github pages (Jekyll) live reload with docker

G

I really like Github Pages to host static webpages. Static in this case means the files are generated at build time (so once when you publish a new version), instead of every time like with a wordpress website. One of the main benefits is that it results in a blazing fast website.

Git extra author

G

If someone else created some sourcecode, but for whatever reason they aren’t the one adding it to the repository. You can still have their name/photo in the git commit.

Fork proof actions

F

Github actions are a great tool to setup automatic build and tests. I also use it for any of my automatic releases. See this post. Until now there was one thing missing. If someone would fork the repository, all builds would fail because of missing secrets needed for the release.

Yesterday I released my first github action, it allows you to check if certain secrets are set, and then decide to continue yourself. Or skip specific steps, this functionallity seemed to be missing from the actions marketplace. So now yoou can check the existens of certain secrets (or other inputs), and decide to either have the actioon run fail or just continue and skip some steps.

Like what you're seeing? Consider Sharing on Twitter or Sponsoring me