Skip to content

Instantly share code, notes, and snippets.

@katyukha
Last active October 30, 2021 18:02
Show Gist options
  • Save katyukha/5c5db1216f9a9f6f41d9b0361822f7fe to your computer and use it in GitHub Desktop.
Save katyukha/5c5db1216f9a9f6f41d9b0361822f7fe to your computer and use it in GitHub Desktop.
My environment
#!/bin/bash
# To use just run following command in shell:
# wget -O - https://gist.githubusercontent.com/katyukha/5c5db1216f9a9f6f41d9b0361822f7fe/raw/create_env.bash | bash -s
# install vim config (if it is not installed yet)
if [ ! -d $HOME/.vim ]; then
CURRENT_DIR=$(pwd);
cd $HOME;
git clone https://github.com/katyukha/.vim.git .vim;
ln -sf .vim/.vimrc .vimrc;
cd .vim/;
git submodule init;
git submodule update;
cd $CURRENT_DIR;
fi
# generate .gitconfig
cat > $HOME/.gitconfig << EOF
[alias]
co = "checkout"
ci = "commit"
st = "status"
br = "branch"
glog = "log --graph --color --decorate" # log in graph form
slog = "log --stat --color --decorate" # log that displays stat
sglog = "log --stat --graph --color --decorate" # log with stat in graph mode
cdiff = "diff --color" # colored diff
lsbra = "branch -a --color" # list all branches, even remote ones
lsbr = "branch --color"
# remove branch named after it, e.g. git rmbr upgrading_rails
rmbr = "branch -d"
# rename branch from one name to another
mvbr = "branch -m"
lstag = "tag -l"
# create a new tag based on specified commit
mktag = "tag -a"
# remove existing tag by name
rmtag = "tag -d"
# rename tag from one name to another
mvtag = "tag -m"
cshow = "show --color"
EOF
if [ ! -d "$HOME/.bash/git-aware-prompt" ]; then
mkdir "$HOME/.bash";
git clone git://github.com/jimeh/git-aware-prompt.git "$HOME/.bash/git-aware-prompt";
echo '' >> $HOME/.bashrc;
echo '# Enabled colord git-aware prompt' >> $HOME/.bashrc;
echo 'export GITAWAREPROMPT=$HOME/.bash/git-aware-prompt' >> $HOME/.bashrc;
echo 'source "${GITAWAREPROMPT}/main.sh"' >> $HOME/.bashrc;
echo 'export PS1="\${debian_chroot:+(\$debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \[$txtcyn\]\$git_branch\[$txtred\]\$git_dirty\[$txtrst\]\$ "' >> $HOME/.bashrc;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment