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 developgit rebase --interactive --autosquash
Mnemonic: git rebase interactive autosquash
gr origin/developgit rebase --interactive --autosquash origin/develop
grodgit rebase --interactive --autosquash origin/master
gromgit rebase --interactive --autosquash with the current branch onto the branch of the same name on origin
grogit diff origin/develop
gdodgit diff --stat origin/develop
gdsodgit diff origin/develop
gdomgit diff --stat origin/master
gdsomgit 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
gpfPush 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}/.bashrcReturn the current branch of the worktree.
- 0: Successful.
- 1: Unable to read current branch.