- For all readonly purpose this works great.
- For big repo like linux project, mozilla firefox or WordPress like project it's really boring to wait for git to fetch all refs since we rearely needs all refs (if you know you're not gonna need).
- You can contribute even after shallow clone but it works only in somecases mentioned below.
git clone -b master git_url --depth 1
git fetch origin master:master --depth 1
# OR
git pull origin master --depth=1
git fetch --tags --depth=1
You can contribute using shallow commmit, As long as your commit history having all commits it needs to refer.
git fetch --unshallow
--unshallow
will fetch all refs so it doesn't work well with branch fetch, meaning you can't chckout new branch from master
and add some 10 commits on new branch and expect --unshallow
to fetch those 10 commits only.
You can fetch all branch you need as describe above, Now you can create new branch and from existing one and add commits on top and it should work as long as you're the only one adding the commits. Assuming you're not merging/rebasing that branch with base branch. In such case you need to do unshallow.
Nice!