1

I have huge size of git repo in my local system with 10 different branches, In those 10 branch the master repository is around 2 GB. when i switch from any branch1 to master branch, Git is trying to checkout all files in local system itself, how to reduce the time here.

  [linux@linux_001 myrepo]$ time git checkout master
   Checking out files: 100% (25765/25765), done.
   Switched to branch 'master'

   real    0m55.617s
   user    0m35.597s
   sys     0m5.002s

Here i have reduce 55 sec

Zoe
  • 27,060
  • 21
  • 118
  • 148
Vinoth
  • 189
  • 1
  • 1
  • 9

1 Answers1

0

One workaround would be to use the git worktree command: you can clone a repo once, but check it out in multiple folders, one per branch.

That way, instead of changing your current worktree, you can simply change folder to the one where master is already checked out) and update its content with a git pull (incremental update, much faster)

That seems easier than trying to put in place a sparse checkout or a shallow clone.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250