tokuhirom's Blog

Architecture of git-new-workdir

Why is git-new-workdir fast?

for x in config refs logs/refs objects info hooks packed-refs remotes rr-cache svn
do
        case $x in
        */*)
                mkdir -p "$(dirname "$new_workdir/.git/$x")"
                ;;
        esac
        ln -s "$git_dir/$x" "$new_workdir/.git/$x"
done

cp "$git_dir/HEAD" .git/HEAD

git checkout -f $branch

Answer: it just links .git/ directory. link is faster than copy.