Code/Git
Jump to navigation
Jump to search
Commands
Create bare repo
git clone --bare /tmp/repo.git scp -r /tmp/repo.git <server>:repo.git git remote add origin git@example.com:repo.git git checkout origin/master
Git shell
function _git_prompt() {
local git_status="`git status -unormal 2>&1`"
if ! [[ "$git_status" =~ Not\ a\ git\ repo ]]; then
if [[ "$git_status" =~ nothing\ to\ commit ]]; then
local ansi=32
elif [[ "$git_status" =~ nothing\ added\ to\ commit\ but\ untracked\ files\ present ]]; then
local ansi=34
else
local ansi=33
fi
echo -n '\[\e[0;33;'"$ansi"'m\]'"$(__git_ps1)"'\[\e[0m\]'
fi
}
if [ "$color_prompt" = yes ]; then
FPS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
#PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$`_git_prompt` "
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
function _prompt_command() {
#PS1="[\[\033[32m\]\w\[\033[0m\]]\[\033[0m\]\n\[\033[1;36m\]\u@\[\033[0;37m\]\h] `_git_prompt` \[\033[1;33m\]-> \[\033[0m\]"
PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w`_git_prompt`\[\033[00m\] \$ "
}
PROMPT_COMMAND=_prompt_command