From ea04e82c3644197e799778f92814844ea433ae1c Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sat, 1 Jun 2019 22:59:08 -0400 Subject: [PATCH] [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). --- bash/aliases | 5 ++++- bash/bash_prompt | 4 ---- bash/bashrc | 2 ++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/bash/aliases b/bash/aliases index 6b5972a..5eafd5a 100644 --- 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 index 6527531..9bfb318 100644 --- 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 index 6f6a5d6..d8b7763 100644 --- 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 -- libgit2 0.28.4