Skip to content

Instantly share code, notes, and snippets.

@JackNUMBER
Last active October 8, 2024 15:40
Show Gist options
  • Select an option

  • Save JackNUMBER/66d5871a6c0e268669621168a7cf24a3 to your computer and use it in GitHub Desktop.

Select an option

Save JackNUMBER/66d5871a6c0e268669621168a7cf24a3 to your computer and use it in GitHub Desktop.
.bashrc
. ~/.git-prompt.sh
# prompt (current folder + git)
export GIT_PS1_SHOWDIRTYSTATE=true
setopt PROMPT_SUBST ; PS1='%F{green}%1d%f %F{yellow}% $(__git_ps1 "(%s)")%f\$ '
# add ssh keys
if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
ssh-add
fi
# ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# dev aliases
alias npmlist='npm list -g --depth=0'
# GIT
alias pull="git branch && git checkout master && git pull origin master"
alias amend-push="git add -A && git ci --amend -C HEAD && git push -f"
function rebase {
branch=`git branch 2>/dev/null| sed -n '/^\*/s/^\* //p'`
git checkout master
git pull origin master
echo -e "\033[36mpull done \e[0m"
git checkout $branch
git rebase master | egrep --color 'CONFLICT .*|$'
echo -e "\033[36mrebase done \e[0m"
}
function set-upstream {
branch=`git branch 2>/dev/null| sed -n '/^\*/s/^\* //p'`
git branch --set-upstream-to origin/$branch
}
# damn can't memorise this syntax
function sed-replace {
git grep -l "$1" | xargs sed -i "s/$1/$2/g"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment