Last active
July 7, 2021 02:29
-
-
Save a9QrX3Lu/865118896c70912cac4b38d87838f170 to your computer and use it in GitHub Desktop.
Save a copy of current output, which related to current git branch name, commit hash, system environment and time.
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
| #!/usr/bin/env bash | |
| repo=$(basename -s .git $(git config --get remote.origin.url)) | |
| tag=$(git name-rev --tags --name-only $(git rev-parse HEAD)) | |
| branch=$(git rev-parse --abbrev-ref HEAD) | |
| timestamp=$(hostname)-$(uname -r)-$(date -I'seconds') | |
| msg=$(git log -1 | cat) | |
| DIR=~/testdata/${repo}/"${timestamp}-${branch}-${tag}" | |
| # Create dir for the new test data | |
| mkdir -p ${DIR} | |
| for f in $@; do | |
| cp $f ${DIR}/ | |
| done | |
| # Save commit message as a file | |
| echo ${msg} > ${DIR}/cmsg.txt | |
| echo "Result is archived to ${DIR}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment