Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Git stuff

- Changed the ZSH theme a bit to use red / green for dirty / clean
- Added a few aliases, biggest change is that `gl` sets `--ff-only`
- Added a git post-checkout hook, and modified linkem to set things up
  properly.  I want my `ctags` file to be regenerated when I change
  branches, so this hook now does this
  • Loading branch information...
commit aedf4010282249acb0cd8c34284e47ec2d54df40 1 parent 6b85200
Derek Wyatt authored
15 .git_template/post-checkout
View
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+function sha_to_branch_name
+{
+ sha=$1
+ git name-rev --name-only $sha | tr '/' '-'
+}
+
+from=$(sha_to_branch_name $1)
+to=$(sha_to_branch_name $2)
+if [[ $3 == 1 && $from != $to ]]; then
+ code_dir=$(git rev-parse --show-toplevel)
+ tagfile=$(echo $code_dir-$to-tags | tr '/' '-' | cut -c2-)
+ /usr/local/bin/ctags --recurse -f ~/.vim-tags/$tagfile $code_dir &
+fi
4 linkem
View
@@ -1,9 +1,11 @@
#!/bin/bash
-rm -f ~/.bashrc ~/.bashprompt ~/.ctags ~/.dircolors ~/.inputrc ~/.zshrc
+rm -f ~/.bashrc ~/.bashprompt ~/.ctags ~/.dircolors ~/.inputrc ~/.zshrc ~/.git_template
ln -s .dotfiles/bashprompt ~/.bashprompt
ln -s .dotfiles/bashrc ~/.bashrc
ln -s .dotfiles/ctags ~/.ctags
ln -s .dotfiles/dircolors ~/.dircolors
ln -s .dotfiles/inputrc ~/.inputrc
ln -s .dotfiles/zshrc ~/.zshrc
+ln -s .dotfiles/.git_template ~/.git_template
+git config --global init.templatedir ~/.git_template
11 zsh_custom/themes/gnzh.zsh-theme
View
@@ -27,9 +27,10 @@ function limitGitBranch
local dirty=""
if git status > /dev/null 2>&1; then
if [[ -n $(git status -s) ]]; then
- dirty="*"
+ echo "$PR_RED$ZSH_THEME_GIT_PROMPT_PREFIX$br$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOR"
+ else
+ echo "$PR_GREEN$ZSH_THEME_GIT_PROMPT_PREFIX$br$ZSH_THEME_GIT_PROMPT_SUFFIX$PR_NO_COLOR"
fi
- echo "$ZSH_THEME_GIT_PROMPT_PREFIX$br$dirty$ZSH_THEME_GIT_PROMPT_SUFFIX"
else
echo ""
fi
@@ -60,7 +61,7 @@ fi
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
eval PR_HOST='${PR_YELLOW}%m${PR_NO_COLOR}' #SSH
else
- eval PR_HOST='${PR_GREEN}%m${PR_NO_COLOR}' # no SSH
+ eval PR_HOST='${PR_MAGENTA}%m${PR_NO_COLOR}' # no SSH
fi
local return_code="%(?..%{$PR_RED%}%? ↵%{$PR_NO_COLOR%})"
@@ -73,5 +74,5 @@ PROMPT="╭─${user_host} ${git_branch}${current_dir}
╰─$PR_PROMPT "
RPS1="${return_code}"
-ZSH_THEME_GIT_PROMPT_PREFIX="%{$PR_RED%}‹"
-ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$PR_NO_COLOR%}"
+ZSH_THEME_GIT_PROMPT_PREFIX="‹"
+ZSH_THEME_GIT_PROMPT_SUFFIX="› "
13 zshrc
View
@@ -182,9 +182,10 @@ function findExtension
fi
findWithSpec $dir '-name \*'.$ext
}
-alias fe=findExtension
+alias fe=findExtension
alias f=findWithSpec
+alias fn='find . -name'
function findClass
{
@@ -245,11 +246,16 @@ alias xg='xargs egrep'
alias xgi='xargs egrep -i'
alias pd="cd -"
alias grss='for f in $(find . -type d -a -name .git); do x=${f%/.git}; echo ==== $x; (cd $x; gss); done'
-alias gd='git diff'
-alias gdc='git diff --cached'
alias o=octave
alias mvn=~/bin/mvn-colour
+alias gl='git pull --ff-only'
+alias gf='git fetch'
+alias gd='git diff'
+alias gdc='git diff --cached'
+
+alias gld="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
+
alias sc=screen
alias scl="screen -list"
@@ -261,3 +267,4 @@ test -f ~/.zshrc_local && . ~/.zshrc_local
# Auvik Settings
export JAVA_OPTS="-XX:ReservedCodeCacheSize=128m -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=1024m -Xmx1024m -Xss2m -XX:+UseCodeCacheFlushing"
+
Please sign in to comment.
Something went wrong with that request. Please try again.