Skip to content

Instantly share code, notes, and snippets.

@aemarkov
Created September 29, 2018 13:14
Show Gist options
  • Save aemarkov/3ddac3f224e11f00ce34db4f74c75173 to your computer and use it in GitHub Desktop.
Save aemarkov/3ddac3f224e11f00ce34db4f74c75173 to your computer and use it in GitHub Desktop.
git sparase-checkout cheatshit

Ok, you have GIT repository somewhere with some separated parts. You want to commit them separately, maybe from different computer. So, how you can do this?

GIT SPARSE CHECKOUT, MOTHERFUCKER!

Assume your repo have some example structure:

\my_fucking_repo
  \part1
  \part2

Somewhere on PC where you want to use part1

$ git config --global core.sparsecheckout true  # or use local config, why not
$ mkdir my_fucking_repo
$ cd my_fucking_repo
$ git init
$ git remote add -f origin <my_fucking_repo url>
$ echo part1 >> .git/info/sparse-checkout      # add all folders you want to work on this PC
$ git clone

IT'S DONE. Look what you have:

$ ls
part1       # only part1, motherfukcer!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment