i have a local repository with ~300.000 files and about 40gb on an encrypted filesystem (and i cannot change that ...). i often need to create a new branch and make the current contents of the working directory the contents of this branch.
so this "checkout" is not actually a checkout that modifies anything in the working tree, but just creates a branch, switches to it, and leaves the working directory unchanged. and it is not about large files: the average file size is much less than 1mb (40gb/300000=130kb)
currently i do:
git checkout -q -b mynewbranch
git add -v -A
git commit -q -m "at mynewbranch"
in principle this works, but the first step to create the branch takes more than an hour (!). (the "add" and "commit" take a few minutes, i could live with that.) the "git checkout" seems to re-read the whole working directory just in order to create the branch.
ideally i would want that creating the branch would take almost no time at all, and its state should simply be based on a previously existing branch. and then the "add" should also not take too much time since timestamps may be used and not all file contents should be compared to the repository, only files with new timestamps should be looked at in detail.
has anybody an idea how this can be done efficiently ?
edit: git 2.17, ubuntu, encfs over ext4, recent hardware, 12 cpu, mostly binary files (like pdf, jpeg, mp4; no deep tree; they need to be versioned).
the primary issue is: can it be avoided that just creating a branch looks at the content of all files ?