4 ms·
I work at a company with micro services so we have a lot of repos. We use nodejs and in some cases use different node versions among different services. Having
by godot 8y ago
I work at a company with micro services so we have a lot of repos. We use nodejs and in some cases use different node versions among different services. Having the prompt show what branch I'm in and what node version I'm on is quite helpful:
PS1="\[\033[01;31m\]Node \`node --version\`: \[\033[01;32m\]\`pwd\` \`git status -sb 2> /dev/null | head -n 1\`\n\[\033[01;34m\]\`date +'%a, %B %-d, %-l:%M:%S%P'\` \[\033[01;31m\]\$ \[\033[00m\]"
Pruning branches both remote and locally are also very helpful to do in these alias/functions:
function gitpruneremote {
git remote prune origin
}
function gitprunelocal {
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -D
}
Git pulling in every repo:
function gitpullall {
cd ~/yourCodeDir
find . -type d -depth 1 -exec git --git-dir={}/.git --work-tree=$PWD/{} pull \;
}
This one is simple, and was useful in my LAMP dev days, to tail apache logs with line breaks formatted:
function tailerr() {
tail -f /path/to/errorlog | sed 's/\\n/\n/g'
}