Last active
July 29, 2022 09:31
-
-
Save chr5tphr/7df4a137597e9b62e56fd47dbb11bc06 to your computer and use it in GitHub Desktop.
Synchronize uncomitted changes
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 | |
RMTE="${1:?"No host supplied!"}" | |
RDIR="${2:?"No path supplied!"}" | |
REPO="${3:-"refs/heads/sync"}" | |
git push "${RMTE}:${RDIR}" "+@:${REPO}" && git diff HEAD | ssh "${RMTE}" \ | |
"{ git -C '${RDIR}' reset --hard '${REPO}' && git -C '${RDIR}' apply --index - ; }" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment