This morning I made a shallow clone of the Linux sources
git clone --depth 1 https://github.com/torvalds/linux.git
which resulted in a linux
folder of 851Mb.
Now I would like to pull the latest changes, but
git pull
starts a seemly huge download. After 60Mb I'm at 3% which extrapolates to 2Gb. However, the 5 commits since my clone change only a bunch of lines.
Am I doing something wrong? What are the 2Gb that git
tries to download?
Developers should be aware that the depth 1 clone operation only pulls down one branch. If the remote repository contains other branches, they won't be able to check them out locally without a pathspec error. After a git clone depth 1 operation, attempts to checkout an alternate branch will trigger a pathspec error.
To pull down (i.e. copy) the changes merged into your fork, you can use the Terminal and the git pull command. To begin: On your local computer, navigate to your forked repo directory. Once you have changed directories to the forked repo directory, run the command git pull .
After the clone, a plain git fetch without arguments will update all the remote-tracking branches, and a git pull without arguments will in addition merge the remote master branch into the current master branch, if any (this is untrue when "--single-branch" is given; see below).
The git pull command first runs a git fetch command to check for changes. The fetch operation returns the metadata for our commits . Then, the git pull command retrieves all the changes we have made to our remote repository and changes our local files.
I think you can use --depth 1
in git pull
too, so it gets just what's needed for the newest commit in the repository.
I don't know if the default behaviour is to pull everything missing, because my git help pull
shows this option:
git pull --unshallow
or
git fetch --unshallow
--unshallow Convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.
I'm running git version 1.8.5.2 (Apple Git-48)
, and maybe this is some sort-of-new behaviour, and changing a bit between versions.
Could any of the new commits be merge-commits pointing to commits not present in your tree? Perhaps --depth 1000
would work better and still be small enough.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With