Skip to content

Instantly share code, notes, and snippets.

Created April 6, 2017 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/e1e29f0eb9df25b506fdf555827c73ac to your computer and use it in GitHub Desktop.
Save anonymous/e1e29f0eb9df25b506fdf555827c73ac to your computer and use it in GitHub Desktop.
$ git --version
git version 2.12.0.windows.1
$ git clone https://github.com/nallar/git-issue-sparse-checkout.git mcve-sparse-checkout
Cloning into 'mcve-sparse-checkout'...
remote: Counting objects: 17, done.
remote: Total 17 (delta 0), reused 0 (delta 0), pack-reused 17
Unpacking objects: 100% (17/17), done.
$ cd mcve-sparse-checkout
$ git checkout other
Switched to a new branch 'other'
Branch other set up to track remote branch other from origin.
$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
$ git config core.sparseCheckout true
$ cp sparse-checkout .git/info/sparse-checkout
$ git checkout -f master
Already on 'master'
Your branch is up-to-date with 'origin/master'.
$ git reset --hard HEAD
HEAD is now at 812b281 Add example files to demonstrate issue
$ ls
normal-folder/ sparse-checkout
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean
$ git cherry-pick other
[master f4dcfec] cherry-pick this: Change an unrelated file
Author: Ross Allan <>
Date: Tue Jul 5 10:50:36 2016 +0100
1 file changed, 3 insertions(+), 1 deletion(-)
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
deleted: excluded-folder/1.txt
no changes added to commit (use "git add" and/or "git commit -a")
$ git update-index --skip-worktree excluded-folder/1.txt
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment