Last active
August 29, 2015 14:23
-
-
Save rajeshvaya/882246f532cde78cc365 to your computer and use it in GitHub Desktop.
Git (print) checkout only updated files of a commit / or commit range
This file contains 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/bash | |
function git_checkout_commit_files(){ | |
# ${1} is the remote branch location | |
# ${2} is the commit id | |
printf "Starting to checkout files from remote/branch: ${1} at commit: ${2}\n" | |
sleep 1 | |
printf "Fetching updates from git, please wait...\n" | |
git pull && printf "Successfully fetched update from ${1}\n Checking-out the files now, please wait..." && sleep 1 && git diff-tree --no-commit-id --name-only -r ${2} | xargs git checkout ${1} | |
} |
This file contains 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/bash | |
function git_print_checkout_commit_files(){ | |
# ${1} is the remote branch location | |
# ${2} is the commit id | |
printf "Fetching updates from git, please wait...\n" | |
git fetch && printf "Successfully fetched update from ${1}\n printing checkout commands now, please wait...\n\n" && sleep 1 && git diff-tree --no-commit-id --name-only -r ${2} | xargs -n1 echo "git checkout ${1} " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment