Skip to content

rsinnet/git-bash-aliases

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-bash-aliases

Short aliases for commonly used git commands.

Overview

These aliases allow you to quickly perform everyday commands with git.

Index

gro()

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.

Example

gro

Exit codes

  • 0: Successful.
  • 1: Unable to read current branch.
  • 2: Unable to read user input.
  • 3: Operation canceled by user.

glo()

git log --oneline

Example

glo origin/develop
glo -2
glo -3 develop

gria()

git rebase --interactive --autosquash

Mnemonic: git rebase interactive autosquash

Example

gr origin/develop

grod()

git rebase --interactive --autosquash origin/develop

Example

grod

grom()

git rebase --interactive --autosquash origin/master

Example

grom

gro()

git rebase --interactive --autosquash with the current branch onto the branch of the same name on origin

Example

gro

gdod()

git diff origin/develop

Example

gdod

gdsod()

git diff --stat origin/develop

Example

gdsod

gdom()

git diff origin/develop

Example

gdom

gdsom()

git diff --stat origin/master

Example

gdsom

gdo()

git diff with the branch of the same name on origin

Example

gdo

Exit codes

  • 1: Unable to read current branch.

gdso()

git diff --stat with the branch of the same name on origin

Example

gdso

Exit codes

  • 1: Unable to read current branch.

gpf()

git pull --ff-only

Example

gpf

gposu()

Push the branch to origin and set the upstream.

Example

gposu -f

Exit codes

  • 1: Unable to read current branch.

gpof()

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.

Example

gpof

Exit codes

  • 1: Unable to read current branch.

reinstall-git-bash-completion()

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

Example

reinstall-git-bash-completion
source ${HOME}/.bashrc

__get_local_branch()

Return the current branch of the worktree.

Exit codes

  • 0: Successful.
  • 1: Unable to read current branch.

About

Short aliases for commonly used git commands.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published