dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

commit e1d6a0b66b76ab69e805d34dfb2dca59a43a561b
parent f04853245d6a06606cebe05cbbbcee9c5adf20c2
Author: Bharatvaj H <bharatvaj@yahoo.com>
Date:   Mon, 16 Aug 2021 15:18:06 +0530

Merge branch 'base' of github.com:bharatvaj/dotfiles into termux

Diffstat:
M.config/.gitignore | 2+-
M.config/bash/bashrc | 4++--
A.config/bash/plugin/git | 43+++++++++++++++++++++++++++++++++++++++++++
A.config/bash/plugin/index | 13+++++++++++++
4 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/.config/.gitignore b/.config/.gitignore @@ -1,4 +1,4 @@ -Ignore everything by default. +# Ignore everything by default. * !.gitignore diff --git a/.config/bash/bashrc b/.config/bash/bashrc @@ -15,8 +15,8 @@ done export PS1="\w $ " -# Source plugin index -source "${XDG_CONFIG_HOME}/bash/plugin/index" +# Plugins +[ -f "${XDG_CONFIG_HOME}/bash/plugin/index" ] && . "${XDG_CONFIG_HOME}/bash/plugin/index" # Aliases [ -f "${XDG_CONFIG_HOME}/bash/aliases" ] && . "${XDG_CONFIG_HOME}"/bash/aliases diff --git a/.config/bash/plugin/git b/.config/bash/plugin/git @@ -0,0 +1,43 @@ +# ---------------------- +# Git Aliases +# ---------------------- +alias ga='git add' +alias gaa='git add .' +alias gaaa='git add --all' +alias gau='git add --update' +alias gb='git branch' +alias gbd='git branch --delete ' +alias gc='git commit' +alias gcm='git commit --message' +alias gcf='git commit --fixup' +alias gco='git checkout' +alias gcob='git checkout -b' +alias gcom='git checkout master' +alias gcos='git checkout staging' +alias gcod='git checkout develop' +alias gd='git diff' +alias gda='git diff HEAD' +alias gi='git init' +alias glg='git log --graph --oneline --decorate --all' +alias gld='git log --pretty=format:"%h %ad %s" --date=short --all' +alias gm='git merge --no-ff' +alias gma='git merge --abort' +alias gmc='git merge --continue' +alias gp='git pull' +alias gpr='git pull --rebase' +alias gr='git rebase' +alias gs='git status' +alias gss='git status --short' +alias gst='git stash' +alias gsta='git stash apply' +alias gstd='git stash drop' +alias gstl='git stash list' +alias gstp='git stash pop' +alias gsts='git stash save' + +# ---------------------- +# Git Functions +# ---------------------- +# Git log find by commit message +function glf() { git log --all --grep="$1"; } + diff --git a/.config/bash/plugin/index b/.config/bash/plugin/index @@ -0,0 +1,13 @@ +# Plugins should be sourced from this file +# Instead of hardcoding in bashrc file +# TODO Generalize this(remove bashisms), so we can use this in other shells + +BASH_PLUGIN_DIR="${XDG_CONFIG_HOME}/bash/plugin" + +function bashplug() { + plugin_file="${BASH_PLUGIN_DIR}/$1" + [ -f ${plugin_file} ] && . "${plugin_file}" +} + +# Enable this plugin if 'git' is installed +which git >&/dev/null && bashplug git