You can clone repositories without the whole history

1 min read

This post is part of my Today I learned series in which I share all my learnings regarding web development.

I was browsing electron boilerplates today and inside of the electron-react-boilerplate I found something interesting. The getting started guide include a git clone --depth=1.

git clone --depth=1 your-project-name

What's that? I tried it immediatelly.

/tmp ๐Ÿ˜ฉ  ๐Ÿฟ  ๐Ÿ˜ช
โ–ถ git clone --depth=1 your-project-name
Cloning into 'your-project-name'...

/tmp ๐Ÿ˜‹  ๐Ÿ˜ฆ  ๐Ÿ
โ–ถ cd your-project-name

/tmp/your-project-name ๐Ÿ˜  ๐Ÿ˜  ๐Ÿ˜ท   master ใƒพ(โŒโ– _โ– )ใƒŽ
โ–ถ git lg

* 586b84f Amila Welihinda -  (grafted, HEAD -> master, origin/master, origin/HEAD) Misc code style changes to menu.js (5 weeks ago)

That's interesting! The git history now only includes the latest commit which makes total sense for a boilerplate.

I'll let you decide if that's a real use case though, because I personally would remove the .git folder and start with a proper "Initial commit" but yeah. ยฏ_(ใƒ„)_/ยฏ