mirror of
https://github.com/ohmybash/oh-my-bash.git
synced 2024-05-11 05:55:37 +00:00
Git Plugin
The git plugin defines a number of useful aliases for you. Consult the complete list
How to Use Aliases and Shell Functions for Git with Oh My Bash
This README provides instructions on how to use the provided aliases and shell functions for Git with Oh My Bash. These aliases and functions can significantly improve your Git workflow by simplifying common Git commands and providing useful shortcuts.
Aliases
General Git Commands
g
: Shortcut forgit
.ga
: Shortcut forgit add
. Adds specified files to the staging area.gaa
: Shortcut forgit add --all
. Adds all changes, including untracked files, to the staging area.gc
: Shortcut forgit commit
. Commits changes to the repository.gca
: Shortcut forgit commit --all
. Commits all changes to the repository.gcmsg
: Shortcut forgit commit --message
. Commits changes with a specified message.gd
: Shortcut forgit diff
. Shows changes between commits, commit and working tree, etc.gdca
: Shortcut forgit diff --cached
. Shows changes between staged and last commit.gf
: Shortcut forgit fetch
. Downloads objects and refs from another repository.gg
: Shortcut forgit gui citool
. Launches Git GUI.gl
: Shortcut forgit pull
. Fetches from and integrates with another repository or a local branch.gpr
: Shortcut forgit pull --rebase
. Fetches and rebases changes from another repository.gp
: Shortcut forgit push
. Pushes changes to a remote repository.gs
: Shortcut forgit status
. Shows the working tree status.
Branching and Merging
gcb
: Shortcut forgit checkout -b
. Creates a new branch and switches to it.gco
: Shortcut forgit checkout
. Switches branches or restores working tree files.gm
: Shortcut forgit merge
. Joins two or more development histories together.grb
: Shortcut forgit rebase
. Reapplies commits on top of another base tip.grbi
: Shortcut forgit rebase --interactive
. Reapplies commits interactively.grbd
: Shortcut forgit rebase develop
. Reapplies commits onto the develop branch.gsw
: Shortcut forgit switch
. Switches branches.
Tagging
gta
: Shortcut forgit tag --annotate
. Creates an annotated tag.gts
: Shortcut forgit tag --sign
. Creates a signed tag.gtv
: Shortcut forgit tag
. Lists tags.
Miscellaneous
gclean
: Shortcut forgit clean
. Removes untracked files from the working tree.gunwip
: Undo last commit if marked as work in progress.gignore
: Ignores changes to tracked files.gunignore
: Stops ignoring changes to tracked files.gcount
: Shows commit count by author.gk
: Opens Git GUI.gke
: Opens extended Git GUI.
Shell Functions
current_branch
: Get the name of the current branch.current_repository
: Get the list of remotes for the current repository.work_in_progress
: Warn if the current branch is a work in progress.git_develop_branch
: Check for develop and similarly named branches.git_main_branch
: Check if main exists and use instead of master.
Usage Example
To add all changes and commit with a message, you can use:
gaa && gcmsg "Your commit message"