Skip to content

Instantly share code, notes, and snippets.

@fearphage
Last active November 26, 2018 15:13
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fearphage/dca33cb86e9e7d45d8dadf2b48cea4a9 to your computer and use it in GitHub Desktop.
Save fearphage/dca33cb86e9e7d45d8dadf2b48cea4a9 to your computer and use it in GitHub Desktop.
When you need to save the code before you save yourself, git fire.
[alias]
fire = !"f() { \
local current_branch=$(basename \"$(git symbolic-ref HEAD)\"); \
local new_branch=fire-${current_branch}-$(git config user.email)-$(date +%s) \
local message; \
if [ -z \"$1\" ]; then \
message=\"fire commit from $current_branch\"; \
else \
message=\"$*\"; \
fi; \
git checkout --branch \"$new_branch\"; \
cd \"$(git rev-parse --show-toplevel)\"; \
git add --all; \
git commit --no-verify --message \"$message\"; \
for remote in $(git remote); do \
git push --set-upstream \"$remote\" \"$new_branch\" || true; \
done; \
echo \"\\n\\nFully commited. Now git out!\\n\"; \
}; f"
@GuillaumeVerdon
Copy link

@fearphage What if the git server caught on fire too ?

@nilium
Copy link

nilium commented Oct 23, 2018

Needs sunglasses in there somewhere

sunglasses () {
        echo -en " ( •_•)     \r"
        sleep .5
        echo -en " ( •_•)>⌐■-■\r"
        sleep 1
        echo " (⌐■_■)     "
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment