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 https://github.com/chentsulin/electron-react-boilerplate.git your-project-name

What's that? I tried it immediatelly.

/tmp 😩  🐿  😪
▶ git clone --depth=1 https://github.com/chentsulin/electron-react-boilerplate.git 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)
(END)

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. ¯_(ツ)_/¯

Tags

Load time