Last active
March 17, 2023 15:35
-
-
Save devinrhode2/6e370ddfe824b1f49515f56e6314a434 to your computer and use it in GitHub Desktop.
git add-archive <sha>
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
[alias] | |
add-archive = "!runit() { REFS_BRANCH=`git branch -a --contains $1 | xargs` && \ | |
NEW_REF=`echo refs/archive/$(date '+%Y-%m-%d')/$(git config user.name)/$REFS_BRANCH/$(date '+%s')` && \ | |
git update-ref $NEW_REF $1 && \ | |
echo consider deleting $REFS_BRANCH && \ | |
echo attempting to backup archives && \ | |
git push origin refs/archive/*:refs/archive/* && \ | |
echo Here is your remote commit ref url && \ | |
echo https://github.com/org/repo/commit/$1; }; runit" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
git branch
command may need--format=refname
, or something similar, to remove prefixes like+
and*
.