548 lines
8.1 KiB
Bash
548 lines
8.1 KiB
Bash
RWX_GIT_LOG_FORMAT="\
|
|
%C(auto)%h%d
|
|
S %C(red)%GS
|
|
A %C(green)%an %ae
|
|
%C(green)%ai
|
|
C %C(blue)%cn %ce
|
|
%C(blue)%ci
|
|
%B"
|
|
|
|
# add to index
|
|
ga() { a__git_add "${@}"; }
|
|
a__git_add() {
|
|
git \
|
|
add \
|
|
"${@}"
|
|
}
|
|
|
|
# add all to index
|
|
gaa() { a__git_add_all "${@}"; }
|
|
a__git_add_all() {
|
|
git \
|
|
add \
|
|
--all \
|
|
"${@}"
|
|
}
|
|
|
|
# add parts of all to index
|
|
gaap() { a__git_add_all_patch "${@}"; }
|
|
a__git_add_all_patch() {
|
|
git \
|
|
add \
|
|
--all \
|
|
--patch \
|
|
"${@}"
|
|
}
|
|
|
|
# add parts to index
|
|
gap() { a__git_add_patch "${@}"; }
|
|
a__git_add_patch() {
|
|
git \
|
|
add \
|
|
--patch \
|
|
"${@}"
|
|
}
|
|
|
|
# create a branch
|
|
gb() { a__git_branch "${@}"; }
|
|
a__git_branch() {
|
|
git \
|
|
branch \
|
|
"${@}"
|
|
}
|
|
|
|
# delete a branch
|
|
gbd() { a__git_branch_delete "${@}"; }
|
|
a__git_branch_delete() {
|
|
git \
|
|
branch \
|
|
--delete \
|
|
"${@}"
|
|
}
|
|
|
|
# force a branch deletion
|
|
gbdf() { a__git_branch_delete_force "${@}"; }
|
|
a__git_branch_delete_force() {
|
|
git \
|
|
branch \
|
|
--delete \
|
|
--force \
|
|
"${@}"
|
|
}
|
|
|
|
# list branches
|
|
gbl() { a__git_branch_list "${@}"; }
|
|
a__git_branch_list() {
|
|
git \
|
|
branch \
|
|
--all \
|
|
--list \
|
|
--verbose \
|
|
--verbose \
|
|
"${@}"
|
|
}
|
|
|
|
# set the link to a remote branch from a local branch
|
|
gbsu() { a__git_branch_set_upstream "${@}"; }
|
|
a__git_branch_set_upstream() {
|
|
git \
|
|
branch \
|
|
--set-upstream-to \
|
|
"${@}"
|
|
}
|
|
|
|
# switch to a branch or checkout file(s) from a commit
|
|
gc() { a__git_checkout "${@}"; }
|
|
a__git_checkout() {
|
|
git \
|
|
checkout \
|
|
"${@}"
|
|
}
|
|
|
|
# checkout an orphan branch
|
|
gco() { a__git_checkout_orphan "${@}"; }
|
|
a__git_checkout_orphan() {
|
|
git \
|
|
checkout \
|
|
--orphan \
|
|
"${@}"
|
|
}
|
|
|
|
# pick a commit
|
|
gcp() { a__git_cherry_pick "${@}"; }
|
|
a__git_cherry_pick() {
|
|
git \
|
|
cherry-pick \
|
|
"${@}"
|
|
}
|
|
|
|
# abort the commit pick
|
|
gcpa() { a__git_cherry_pick_abort "${@}"; }
|
|
a__git_cherry_pick_abort() {
|
|
git \
|
|
cherry-pick \
|
|
--abort \
|
|
"${@}"
|
|
}
|
|
|
|
# continue the commit pick
|
|
gcpc() { a__git_cherry_pick_continue "${@}"; }
|
|
a__git_cherry_pick_continue() {
|
|
git \
|
|
cherry-pick \
|
|
--continue \
|
|
"${@}"
|
|
}
|
|
|
|
# clean untracked files
|
|
gcf() { a__git_clean_force "${@}"; }
|
|
a__git_clean_force() {
|
|
git \
|
|
clean \
|
|
-d \
|
|
--force \
|
|
"${@}"
|
|
}
|
|
|
|
# redo the last commit with a different message
|
|
gcam() { a__git_commit_amend_message "${@}"; }
|
|
a__git_commit_amend_message() {
|
|
git \
|
|
commit \
|
|
--amend \
|
|
--message \
|
|
"${@}"
|
|
}
|
|
|
|
# make a root commit
|
|
gcem() { a__git_commit_empty_message "${@}"; }
|
|
a__git_commit_empty_message() {
|
|
git \
|
|
commit \
|
|
--allow-empty \
|
|
--allow-empty-message \
|
|
--message \
|
|
"${@}"
|
|
}
|
|
|
|
# commit the index
|
|
gcm() { a__git_commit_message "${@}"; }
|
|
a__git_commit_message() {
|
|
git \
|
|
commit \
|
|
--message \
|
|
"${@}"
|
|
}
|
|
|
|
# configure the user email
|
|
gcue() { a__git_config_user_email "${@}"; }
|
|
a__git_config_user_email() {
|
|
git \
|
|
config \
|
|
"user.email" \
|
|
"${@}"
|
|
}
|
|
|
|
# configure the user name
|
|
gcun() { a__git_config_user_name "${@}"; }
|
|
a__git_config_user_name() {
|
|
git \
|
|
config \
|
|
"user.name" \
|
|
"${@}"
|
|
}
|
|
|
|
# differences from last or between commits
|
|
gd() { a__git_diff "${@}"; }
|
|
a__git_diff() {
|
|
git \
|
|
diff \
|
|
"${@}"
|
|
}
|
|
|
|
# display what is indexed in cache
|
|
gdc() { a__git_diff_cached "${@}"; }
|
|
a__git_diff_cached() {
|
|
git \
|
|
diff \
|
|
--cached \
|
|
"${@}"
|
|
}
|
|
|
|
# indexed character-level differences
|
|
gdcw() { a__git_diff_cached_word "${@}"; }
|
|
a__git_diff_cached_word() {
|
|
git \
|
|
diff \
|
|
--cached \
|
|
--word-diff-regex "." \
|
|
"${@}"
|
|
}
|
|
|
|
# differences via external tool
|
|
gdt() { a__git_diff_tool "${@}"; }
|
|
a__git_diff_tool() {
|
|
git \
|
|
difftool \
|
|
--dir-diff \
|
|
"${@}"
|
|
}
|
|
|
|
# character-level differences
|
|
gdw() { a__git_diff_word "${@}"; }
|
|
a__git_diff_word() {
|
|
git \
|
|
diff \
|
|
--word-diff-regex "." \
|
|
"${@}"
|
|
}
|
|
|
|
# fetch from the remote repository
|
|
gf() { a__git_fetch "${@}"; }
|
|
a__git_fetch() {
|
|
rwx_gpg_agent_update &&
|
|
git \
|
|
fetch \
|
|
--tags \
|
|
--verbose \
|
|
"${@}"
|
|
}
|
|
|
|
# fetch from remote repository and prune local orphan branches
|
|
gfp() { a__git_fetch_prune "${@}"; }
|
|
a__git_fetch_prune() {
|
|
a__git_fetch \
|
|
--prune \
|
|
"${@}"
|
|
}
|
|
|
|
# garbage collect all orphan commits
|
|
ggc() { a__git_garbage_collect "${@}"; }
|
|
a__git_garbage_collect() {
|
|
git \
|
|
reflog \
|
|
expire \
|
|
--all \
|
|
--expire "all" &&
|
|
git \
|
|
gc \
|
|
--aggressive \
|
|
--prune="now"
|
|
}
|
|
|
|
# initialize a new repository
|
|
gi() { a__git_init "${@}"; }
|
|
a__git_init() {
|
|
git \
|
|
init \
|
|
"${@}"
|
|
}
|
|
|
|
# initialize a new bare repository
|
|
gib() { a__git_init_bare "${@}"; }
|
|
a__git_init_bare() {
|
|
git \
|
|
init \
|
|
--bare \
|
|
"${@}"
|
|
}
|
|
|
|
# log history
|
|
gl() { a__git_log "${@}"; }
|
|
a__git_log() {
|
|
git \
|
|
log \
|
|
--abbrev=8 \
|
|
--abbrev-commit \
|
|
--format="${RWX_GIT_LOG_FORMAT}" \
|
|
--graph \
|
|
"${@}"
|
|
}
|
|
|
|
# log all history
|
|
gla() { a__git_log_all "${@}"; }
|
|
a__git_log_all() {
|
|
a__git_log \
|
|
--all \
|
|
"${@}"
|
|
}
|
|
|
|
# log all history with patches
|
|
glap() { a__git_log_all_patch "${@}"; }
|
|
a__git_log_all_patch() {
|
|
a__git_log \
|
|
--all \
|
|
--patch \
|
|
"${@}"
|
|
}
|
|
|
|
# log history with patches
|
|
glp() { a__git_log_patch "${@}"; }
|
|
a__git_log_patch() {
|
|
a__git_log \
|
|
--patch \
|
|
"${@}"
|
|
}
|
|
|
|
# fast-forward merge to remote branch
|
|
gm() { a__git_merge "${@}"; }
|
|
a__git_merge() {
|
|
git \
|
|
merge \
|
|
--ff-only \
|
|
"${@}"
|
|
}
|
|
|
|
# abort the current merge commit
|
|
gma() { a__git_merge_abort "${@}"; }
|
|
a__git_merge_abort() {
|
|
git \
|
|
merge \
|
|
--abort \
|
|
"${@}"
|
|
}
|
|
|
|
# do a merge commit
|
|
gmc() { a__git_merge_commit "${@}"; }
|
|
a__git_merge_commit() {
|
|
git \
|
|
merge \
|
|
--no-ff \
|
|
--message \
|
|
"${@}"
|
|
}
|
|
|
|
# squash a branch and index its modifications
|
|
gms() { a__git_merge_squash "${@}"; }
|
|
a__git_merge_squash() {
|
|
git \
|
|
merge \
|
|
--squash \
|
|
"${@}"
|
|
}
|
|
|
|
# merge via external tool
|
|
gmt() { a__git_merge_tool "${@}"; }
|
|
a__git_merge_tool() {
|
|
git \
|
|
mergetool \
|
|
"${@}"
|
|
}
|
|
|
|
# push to the remote repository
|
|
gp() { a__git_push "${@}"; }
|
|
a__git_push() {
|
|
rwx_gpg_agent_update &&
|
|
git \
|
|
push \
|
|
--tags \
|
|
--verbose \
|
|
"${@}"
|
|
}
|
|
|
|
# delete from the remote repository
|
|
gpd() { a__git_push_delete "${@}"; }
|
|
a__git_push_delete() {
|
|
git \
|
|
push \
|
|
--delete \
|
|
"${@}"
|
|
}
|
|
|
|
# force the push to the remote repository
|
|
gpf() { a__git_push_force "${@}"; }
|
|
a__git_push_force() {
|
|
a__git_push \
|
|
--force \
|
|
"${@}"
|
|
}
|
|
|
|
# rebase current branch onto another
|
|
grb() { a__git_re_base "${@}"; }
|
|
a__git_re_base() {
|
|
git \
|
|
rebase \
|
|
"${@}"
|
|
}
|
|
|
|
# abort current rebase
|
|
grba() { a__git_re_base_abort "${@}"; }
|
|
a__git_re_base_abort() {
|
|
git \
|
|
rebase \
|
|
--abort \
|
|
"${@}"
|
|
}
|
|
|
|
# continue current rebase
|
|
grbc() { a__git_re_base_continue "${@}"; }
|
|
a__git_re_base_continue() {
|
|
git \
|
|
rebase \
|
|
--continue \
|
|
"${@}"
|
|
}
|
|
|
|
# force rebase without fast-forward
|
|
grbf() { a__git_re_base_force "${@}"; }
|
|
a__git_re_base_force() {
|
|
git \
|
|
rebase \
|
|
--force-rebase \
|
|
"${@}"
|
|
}
|
|
|
|
# rebase interactively
|
|
grbi() { a__git_re_base_interactive "${@}"; }
|
|
a__git_re_base_interactive() {
|
|
git \
|
|
rebase \
|
|
--interactive \
|
|
"${@}"
|
|
}
|
|
|
|
# add a new remote repository
|
|
grma() { a__git_re_mote_add "${@}"; }
|
|
a__git_re_mote_add() {
|
|
git \
|
|
remote \
|
|
add \
|
|
"${@}"
|
|
}
|
|
|
|
# list remote repositories
|
|
grml() { a__git_re_mote_list "${@}"; }
|
|
a__git_re_mote_list() {
|
|
git \
|
|
remote \
|
|
--verbose \
|
|
"${@}"
|
|
}
|
|
|
|
# set the location of a remote repository
|
|
grmsu() { a__git_re_mote_set_upstream "${@}"; }
|
|
a__git_re_mote_set_upstream() {
|
|
git \
|
|
remote \
|
|
set-url \
|
|
"${@}"
|
|
}
|
|
|
|
# show connection to a remote repository
|
|
grms() { a__git_re_mote_show "${@}"; }
|
|
a__git_re_mote_show() {
|
|
git \
|
|
remote \
|
|
show \
|
|
"${@}"
|
|
}
|
|
|
|
# remove and add removal to index
|
|
grm() { a__git_re_move "${@}"; }
|
|
a__git_re_move() {
|
|
git \
|
|
rm \
|
|
"${@}"
|
|
}
|
|
|
|
# remove file(s) from index or move current branch pointer
|
|
grs() { a__git_re_set "${@}"; }
|
|
a__git_re_set() {
|
|
git \
|
|
reset \
|
|
"${@}"
|
|
}
|
|
|
|
# wipe modifications or reset current branch to another commit
|
|
grsh() { a__git_re_set_hard "${@}"; }
|
|
a__git_re_set_hard() {
|
|
git \
|
|
reset \
|
|
--hard \
|
|
"${@}"
|
|
}
|
|
|
|
# show a commit
|
|
gsc() { a__git_show_commit "${@}"; }
|
|
a__git_show_commit() {
|
|
git \
|
|
show \
|
|
"${@}"
|
|
}
|
|
|
|
# current state of repository
|
|
gs() { a__git_status "${@}"; }
|
|
a__git_status() {
|
|
git \
|
|
status \
|
|
--untracked-files="all" \
|
|
"${@}"
|
|
}
|
|
|
|
# tag a commit
|
|
gt() { a__git_tag "${@}"; }
|
|
a__git_tag() {
|
|
git \
|
|
tag \
|
|
"${@}"
|
|
}
|
|
|
|
# delete a tag
|
|
gtd() { a__git_tag_delete "${@}"; }
|
|
a__git_tag_delete() {
|
|
git \
|
|
tag \
|
|
--delete \
|
|
"${@}"
|
|
}
|
|
|
|
# update head ref
|
|
gurh() { a__git_update_ref_head "${@}"; }
|
|
a__git_update_ref_head() {
|
|
if [ -n "${2}" ]; then
|
|
git \
|
|
update-ref \
|
|
"refs/heads/${1}" \
|
|
"${2}"
|
|
fi
|
|
}
|