-
Notifications
You must be signed in to change notification settings - Fork 1
Git Sparse Checkout #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* Optionally include branch to pull from, defaults to "main"
* cd || exit is a popular pattern to make sure your program exits if cd fails, but there is no change cd fails in this scenario as we are performing mkdir in the previous step, so removing "|| exit"
if [ "$(git remote show | wc -l)" = "0" ]; then | ||
git remote add origin "$REMOTE" | ||
fi | ||
git config core.sparseCheckout true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't want to make permanent changes to my config. Can we enable flag only on commands that need it.
git/sparse_checkout.sh
Outdated
fi | ||
|
||
# This specifies the remote URL from which to fetch from | ||
REMOTE="$(echo "$URL" | sed -n 's|\(.*github.com\)/\([^/]*\)/\([^/]*\)/\(.*\)|\1/\2/\3.git|p')" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be generic so that it works on non github.com URLs also
If it's easier, we can just ask for these three params separately, instead of deriving from URL
missing files did not restore the missing files + fixed issue where running this script did not pull remote changes to local
Git Sparse checkout script for selectively cloning folders from a repository