Adding promote-script

This commit is contained in:
2026-01-14 14:06:43 -06:00
parent 6d60bbe371
commit 38e55047b5
2 changed files with 40 additions and 1 deletions

39
UserScripts/promote-script Executable file
View File

@@ -0,0 +1,39 @@
#!/usr/bin/bash
# File: promote-script
#
# Description: This script promotes files from one repo, usually a HomeDir, to another.
#
# Package: AniNIX/ShadowArch
# Copyright: WTFPL
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
source /opt/aninix/Uniglot/Bash/header
confirmUser "This will separate the files from previous git history."
# Record the repo
currentrepo="$(git config remote.origin.url)"
# For each file
for file in $@; do
# Copy and add the file
cp "$file" .
git add "$(basename "${file}")"
# Remove the file from the old repo
cd "$(dirname "${file}")"
git rm "$(basename "${file}")"
oldrepo="$(git config remote.origin.url)"
git commit -m "Promoting file to ${currentrepo}"
git push
# Commit the new file.
cd -
git commit -m "Promoting file from ${oldrepo}"
done
# Push
git push