Short aliases for commonly used git commands.
These aliases allow you to quickly perform everyday commands with git.
- gro()
- glo()
- gria()
- grod()
- grom()
- gro()
- gdod()
- gdsod()
- gdom()
- gdsom()
- gdo()
- gdso()
- gpf()
- gposu()
- gpof()
- reinstall-git-bash-completion()
- __get_local_branch()
git reset
the current branch to the one of the same name on origin
Mnemonic: git reset origin
For a local branch named branch
, this script performs:
git reset --hard origin/branch
Arguments are forwarded to git reset
.
gro
- 0: Successful.
- 1: Unable to read current branch.
- 2: Unable to read user input.
- 3: Operation canceled by user.
git log --oneline
glo origin/develop
glo -2
glo -3 develop
git rebase --interactive --autosquash
Mnemonic: git rebase interactive autosquash
gr origin/develop
git rebase --interactive --autosquash origin/develop
grod
git rebase --interactive --autosquash origin/master
grom
git rebase --interactive --autosquash
with the current branch onto the branch of the same name on origin
gro
git diff origin/develop
gdod
git diff --stat origin/develop
gdsod
git diff origin/develop
gdom
git diff --stat origin/master
gdsom
git diff
with the branch of the same name on origin
gdo
- 1: Unable to read current branch.
git diff --stat
with the branch of the same name on origin
gdso
- 1: Unable to read current branch.
git pull --ff-only
gpf
Push the branch to origin and set the upstream.
gposu -f
- 1: Unable to read current branch.
git push --force-with-lease origin
with the current branch to the upstream branch.
If the upstream branch is not set, this command may fail.
gpof
- 1: Unable to read current branch.
Download and reinstall bash completion for git.
Periodically, git bash completions seem to stop working. One fix is to download the bash script from the public repo and copy it over the currently installed file. This command does this, replacing, the existing command.
To fix an existing bash session after this command has been run:
source ${HOME}/.bashrc
reinstall-git-bash-completion
source ${HOME}/.bashrc
Return the current branch of the worktree.
- 0: Successful.
- 1: Unable to read current branch.