Thursday 7 February 2013

How to clone a git repository without history

Suppose if you have one git repository, if you are planning to share that repository to your working partner but it has some sensitive data/files. That time better create a new branch and edit those sensitive files and then get a clone of the repository without history then give to your parter. Using that cloned repository without history, your partner could not able to push that repository to anywhere else. But still you can get work done from your partner as "PATCHES".

Using the following command you can create a shallow repository with truncated/limited history.

git clone --depth 1 url_of_your_remote_repository

Limitation of shallow repository

* you can't clone or fetch from the shallow repository(That means you can't make a new repository using this shallow copy)

* you could not able to view whole history using git log command.

* Its workable solution, your partner can make some changes and make it as "patches" and send it to you partner if you wants your partner changes. Then apply that patches in your current working tree/ whatever branches you want to apply.

No comments :

Post a Comment