Created
November 24, 2025 00:56
-
-
Save jcgregorio/a26f15b638f5c3d720f2dddf63e4930a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e | |
| set -x | |
| # Demonstrate quickly checking out a sparse and shallow clone of a repo, | |
| # applying a change, and pushing it to a new branch. | |
| # | |
| # Generates a random branch name to avoid collisions. | |
| # | |
| # Runs in 1.5 seconds on my machine. | |
| branch=test-$(openssl rand -base64 24) | |
| repo=https://github.com/jcgregorio/chromium.git | |
| cd /tmp | |
| git clone $repo --no-checkout --single-branch --sparse --depth=1 /tmp/chromium | |
| cd /tmp/chromium | |
| git sparse-checkout init --cone # to fetch only root files | |
| git sparse-checkout set ash/accelerators/ # etc, to list sub-folders to checkout | |
| git checkout | |
| git switch -c $branch # | |
| echo "# test" >> ash/accelerators/README.md | |
| git commit -am "test commit" | |
| git push origin $branch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment