1

I am trying to do a git clone from a repository in my window, but the source code contains these 2 files, that my git cloning on window keeps failing.

./templates/extender/sync/os_firmware/[4.2.2.291,4.2.3.517)|[7.0.0.0,7.0.1.0).jinja2
./templates/extender/sync/os_firmware/(-inf,4.2.2.291)|[4.2.3.517,7.0.0.0)|[7.0.1.0,+inf).jinja2

To work around, I have to create a special branch on ubuntu, get rid of these 2 files, and then have this special branch cloned on my window, ... once my code is committed, I had to have these 2 files added back.

Is there a simple solution for this?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
user3595231
  • 711
  • 12
  • 29

1 Answers1

1

You can try a sparse-checkout with exclusion after a git clone --filter=blob:none --no-checkout https://github.com/your/repository

The documentation mentions:

For example, to select everything, and then to remove the file unwanted (so that every file will appear in your working tree except the file named unwanted):

git sparse-checkout set --no-cone '/*' '!unwanted'

These patterns are just placed into the $GIT_DIR/info/sparse-checkout as-is, so the contents of that file at this point would be

/*
!unwanted 
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 1
    Thanks for the tips. For those who have the same issue as mine, "git clone --filter=blob:none --no-checkout https://github.com/your/repository" would clone an empty repository => "git sparse-checkout set your/desired/check_out/dir ", will checkout the needed parts only. – user3595231 Oct 13 '22 at 20:55