commit ea04e82c3644197e799778f92814844ea433ae1c (patch)
parent 4232aa72344bb1820bd6e5e4593af42c9cdc6dcc
Author: Alex Karle <alex@karle.co>
Date: Sat, 1 Jun 2019 22:59:08 -0400
[bash] add git aliases, append history per command
One pain point with history was that if I opened a new split in tmux (or
a new term) the history isn't available yet. By adding "history -a" to
the PROMPT_COMMAND, it will append after each item, being instantly
available to new terms.
This commit also adds a few git aliases along with an alias to reload my
bashrc (as that was something I was doing often enough).
Diffstat:
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/bash/aliases b/bash/aliases
@@ -27,7 +27,9 @@ alias glgr='git log --oneline | head -n 10'
alias g_='git stash'
alias g_p='git stash pop'
alias gb='git branch'
-alias gr='git rebase'
+alias grb='git rebase'
+alias grs='git reset'
+alias gm='git merge'
alias vlg='vim -c "GV"' # 'vim log' of a file
# Git completion for aliases
@@ -53,3 +55,4 @@ alias make='time make'
alias ...='cd ../../..'
alias ....='cd ../../../..'
alias .....='cd ../../../../..'
+alias rb=". ~/.bashrc" # reload bashrc
diff --git a/bash/bash_prompt b/bash/bash_prompt
@@ -55,7 +55,3 @@ if [ -z $SET_PREFERRED_PROMPT ]; then
export PS1="\w\n${ssh_text}\$ "
export PS2="> "
fi
-
-# This command runs after each issuing of PS1
-# Used to add a newline after each prompt
-export PROMPT_COMMAND="echo"
diff --git a/bash/bashrc b/bash/bashrc
@@ -16,6 +16,8 @@ HISTIGNORE=fg:pwd:ls # Don't store common commands in history
HISTCONTROL=ignoreboth # Don't store (1) duplicate commands in history
# AND don't store lines beginning with space
+PROMPT_COMMAND="echo; history -a"
+
# Other Settings
shopt -s checkwinsize # check win size after each cmd, update if needed