So if someone is looking for the option to disable shallow clone in github actions workflow, then just edit the yml file and use the fetch-depth: 0 option with actions/checkout@v2 step to disable shallow clone.
Git provides a fetch --unshallow command which solves the problem, so we just need to run git fetch --unshallow in the repository before running r10k. However, some of our (older) GitLab installs don't make shallow clones. Instead, they make full clones with a single detached branch, so we need fetch --all instead.
Shallow clone is very efficient for cloning only the files with no revision history. This can be beneficial for many continuous integration(CI) processes where we delete the repository at the end of the build. It can also be very useful for making quick commits into the repository.
The below command (git version 1.8.3) will convert the shallow clone to regular one
git fetch --unshallow
Then, to get access to all the branches on origin (thanks @Peter in the comments)
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
git fetch origin
EDIT: git fetch --unshallow
now is an option (thanks Jack O'Connor).
You can run git fetch --depth=1000000
(assuming the repository has less than one million commits).
I needed to deepen a repo only down to a particular commit.
After reading man git-fetch
, I found out that one cannot specify a commit, but can specify a date:
git fetch --shallow-since=15/11/2012
For those who need incremental deepening, another man
quote:
--deepen=<depth>
Similar to --depth, except it specifies the number of commits from the current shallow boundary instead of from the tip of each remote branch history.
Two ways to achieve Shallow Clone to Deep Clone. :
Used the following steps to download the branch: (This downloads the shallow copy of the branch and then converts it into a Full Clone i.e bring complete branch and its history).
a. git clone -b branch http://git.repository/customSP01.git --depth 1
This does a shallow clone (with the depth-option) only fetches only one single branch (at your requested depth).
b. cd customSP01
c. git fetch –depth=100
d. get fetch –depth=500
....
e. git fetch –unshallow
//The above command will convert the shallow clone to regular one. However, this doesn’t bring all the branches:
Then, to get access to all the branches.
f. git remote set-branches origin '*'
[This Step can also be done manually by editing following line in .git/config.
fetch = +refs/heads/master:refs/remotes/origin/master
to (replace master with *):
fetch = +refs/heads/*:refs/remotes/origin/* ]
g. git fetch -v
This converts the Shallow Clone into Deep Clone with all the History and Branch details.
You can avoid steps f and g, if you use the below instead of command present in step a. to do the shallow clone:
git clone -b branch --no-single-branch http://git.repository/customSP01.git --depth 1
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