Last active
December 1, 2021 05:15
-
-
Save keyle/93d1460afdadf758e0bd5a4220f9c9fd to your computer and use it in GitHub Desktop.
update but automatic stashing if there are local changes first then merge back
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
| update() { | |
| YEL="\033[1;33m" | |
| NOP="\033[0m" | |
| output="$(git status --porcelain)" | |
| if [[ -n $output ]] | |
| then | |
| printf "%s\n" "$output" | |
| echo "" | |
| echo "${YEL}stashing...${NOP}" | |
| echo "" | |
| git stash | |
| echo "" | |
| echo "${YEL}updating...${NOP}" | |
| echo "" | |
| git pull --all | |
| echo "" | |
| echo "${YEL}popping...${NOP}" | |
| echo "" | |
| git stash pop | |
| echo "" | |
| echo "${YEL}done...${NOP}" | |
| echo "" | |
| else | |
| echo "" | |
| echo "${YEL}nothing to stash... updating...${NOP}" | |
| echo "" | |
| git pull --all | |
| echo "" | |
| echo "${YEL}done...${NOP}" | |
| echo "" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment