Skip to main content
  1. Posts/

git sparse-checkout enable and disable

·127 words·1 min· ·
Xianpeng Shen
Author
Xianpeng Shen
Table of Contents

This post just a note to myself and it works on my environment. it has not been widely tested.

Enable git sparse-checkout
#

Just in my case, I cloned a git repo exists problems on the Windows platform with some folder, in order to work on the Windows platform we get a work around solution as following:

Case 1: when you not already cloned a repository

mkdir git-src
cd git-src
git init
git config core.sparseCheckout true
echo "/assets/" >> .git/info/sparse-checkout
git remote add origin git@github.com:shenxianpeng/shenxianpeng.git
git fetch
git checkout master

Case 2: when you already cloned a repository

cd git-src
git config core.sparseCheckout true
echo "/assets/" >> .git/info/sparse-checkout
rm -rf <other-file/folder-you-dont-need>
git checkout

Disable git sparse-checkout
#

git config core.sparseCheckout false
git read-tree --empty
git reset --hard

Related

Programmer's Self-Cultivation — Git Commit Message and Branch Creation Conventions
·1643 words·4 mins
This article introduces how to formulate and implement Git commit message and branch creation conventions to improve code quality and team collaboration efficiency.
How to Slim Down Your Git Repository
·1133 words·6 mins
How to remove unnecessary files and history from a Git repository to reduce its size, providing two methods using BFG Repo Cleaner or git filter-branch.
Git History Statistics Generator
·712 words·4 mins
GitStats, a Git history statistics generation tool written in Python, can generate detailed code submission statistical reports to help developers analyze project activity and contributor information.
Resolving the "Could not read from remote repository" Issue
·597 words·3 mins
Resolving the “Could not read from remote repository” error encountered when cloning code using Git, analyzing the causes, and providing solutions.
Git Commit Squash
·226 words·2 mins
How to squash multiple Git commits into a single commit, both locally and remotely, using interactive rebase and merge strategies in Bitbucket.
Resolving the Unavailable Code Sign Default Timestamp Server http://timestamp.verisign.com/scripts/timstamp.dll
·241 words·2 mins
This article describes how to resolve issues with the unavailable Verisign timestamp server, providing alternative timestamp server addresses to help developers successfully complete code signing.