3 ms·
Here are mine, helpful colors and error message included. sync = "!f() { echo \"$(tput setaf 4)Syncing this branch with origin master$(tput sgr 0)\" && git f
by cletusw 11y ago
Here are mine, helpful colors and error message included.
sync = "!f() { echo \"$(tput setaf 4)Syncing this branch with origin master$(tput sgr 0)\" && git fetch origin master && git rebase origin/master && echo \"$(tput setaf 2)Branch sync successful$(tput sgr 0)\"; }; f"
ship = "!f() { echo \"$(tput setaf 4)Shipping this branch to master$(tput sgr 0)\" && git checkout master && (git merge --ff-only - || (echo \"$(tput setaf 1)Could not merge branch into local master\\nRun git sync before running this command\\nIf this error persists, you have local, un-pushed commits in your master branch\\nPush them to origin master or move them into a branch before running this command$(tput sgr 0)\"; git checkout -; return 1)) && (git push origin master || (echo \"$(tput setaf 1)Could not push branch\\nRun git sync before running this command$(tput sgr 0)\"; git reset --hard HEAD@{1}; git checkout -; return 1)) && echo \"$(tput setaf 2)Branch ship successful$(tput sgr 0)\"; }; f"
The reason they are separate is so that you can
git push --force-with-lease origin HEAD:<remote-branch-name>
in between. This way, GitHub marks the PR as "Merged" instead of "Closed with unmerged commits". It's a minor detail, but I like it.