Skip to content

Instantly share code, notes, and snippets.

@innocarpe
Last active August 12, 2020 02:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save innocarpe/b36e7ed4db621bdf4074478a19257f82 to your computer and use it in GitHub Desktop.
Save innocarpe/b36e7ed4db621bdf4074478a19257f82 to your computer and use it in GitHub Desktop.
Short git command of `git push origin CURRENT_BRANCH --force`
#!/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