Git has a feature that we call Shallow Clone; this allows us to make a clone of a repository without taking in the entire history of commits/logs. This helps in a couple of ways; first, it decreases the size of the complete repository quite a bit, and secondly, because of reduced size, it also makes the cloning faster, and you can get started working on it more quickly. To do this, clone using the --depth
option when cloning, like this:
git clone <repository URL> --depth 1
The --depth
the parameter allows you to specify how deep you want to go. So you can have some layers of commits by increasing the depth count:
git clone <repository URL> --depth 3
Now doing this has its perks, but at the same time, as you lose all history, you can not see who committed what, and the original authors lose credits (in a way) for their work. I would recommend doing this in cases when you have a large repo to clone and losing history does not affect you in any way, like downloading a prebuilt app for personal purposes.
Originally Posted On: FirstAidGit