mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
feat(git): add gac alias for staging and committing untracked files
The new `gac` function adds a convenient alias for staging and committing an untracked file in a single command. Example Usage: - `gac file.txt "Add initial version"` This stages `myfile.txt` and commits it with the message "Add initial version."
This commit is contained in:
parent
cae2e45193
commit
f8c09ca13a
1 changed files with 16 additions and 0 deletions
|
|
@ -115,6 +115,22 @@ alias gamscp='git am --show-current-patch'
|
|||
alias gams='git am --skip'
|
||||
alias gap='git apply'
|
||||
alias gapt='git apply --3way'
|
||||
|
||||
# Adds and commits an untracked file.
|
||||
function gac() {
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Usage: gac <file> <commit message>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local file="$1"
|
||||
shift
|
||||
local message="$@"
|
||||
|
||||
git add "$file"
|
||||
git commit -m "$message"
|
||||
}
|
||||
|
||||
alias gbs='git bisect'
|
||||
alias gbsb='git bisect bad'
|
||||
alias gbsg='git bisect good'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue