Last active
August 12, 2020 02:56
-
-
Save innocarpe/b36e7ed4db621bdf4074478a19257f82 to your computer and use it in GitHub Desktop.
Short git command of `git push origin CURRENT_BRANCH --force`
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 | |
# This will forch push current branch to origin | |
# This is just a short version of devxoul's `git pushme` script | |
# https://gist.githubusercontent.com/devxoul/a972ba0db2a25b989887/raw/f62353501becb274eb63c76b83fbcc01250a 286d/git-pushme | |
# | |
# 1. Move this file to ~/.gitsh/ | |
# 2. Add directory path($YOUR_HOME_PATH/.gitsh) to environment variable file | |
# (like ~/.bash_profile or ~/.zshrc) | |
# (This would be like 'export PATH=${PATH}:/Users/YOUR_HOME_PATH/.gitsh') | |
# 3. chmod 0755 git-pmf | |
# 4. Use the command 'git pmf' | |
BRANCH=$(git branch --list | awk '{if ($1 == "*") print $2}') | |
COMMAND="git push --force origin $BRANCH" | |
echo -e "Executing command '$COMMAND'" | |
$COMMAND | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment