Created
September 20, 2017 14:14
-
-
Save rwenz3l/b35367a9834660aac9882a0b68e0a185 to your computer and use it in GitHub Desktop.
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
# Snippets for fun and learning more about git (automation) | |
function abandon-git { | |
rescue_branch="Rescue-Branch-$(date +"%Y-%m-%d-%H-%M-%S")" | |
git checkout -b "${rescue_branch}" | |
git add --ignore-removal . | |
git commit -a -m 'This is a Rescue Commit - saves progress and pushes to new banch' | |
git push --set-upstream origin Rescue-Branch-2017-09-20-15-54-40 | |
} | |
function restore-git { | |
git checkout master | |
last_snapshot=$(git branch | grep Rescue-Branch | sort -r | head -n1 | tr -d ' ') | |
git merge --no-commit "${last_snapshot}" | |
git branch -d "${last_snapshot}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment