Tuesday, October 27, 2015

How to colorify GIT

Add the following tags to your ~/.gitconfig file:

[color]
        diff = auto
        status = auto
        branch = auto
        interactive = auto
From https://glance-stage.cern.ch/wiki/doku.php?id=git:configuration

Friday, October 16, 2015

How to create terminal alias / shortcuts / hotkeys

Edit the file:
vim ~/.bashrc

add the aliases. Mine were:

alias gs='git status'
alias ga='git add'
alias gb='git branch'
alias gc='git commit'
alias gca='git commit --amend'
alias gd='git diff'
alias gdc='git diff --cached'
alias gch='git checkout'
alias gl='git lg1'
alias gpl='git pull'
alias gps='git push'
alias gpssu='git push --set-upstream'
alias gmn='git merge --no-ff'
alias grh='git reset HEAD'

Windows

alias gsh='git show HEAD'

Linux

function gsh() {
    git show HEAD$1
}

function lucas() {
    cd /srv/lucas$1
}

function dev() {
    cd /srv$1
}
Execute the file to make the changes work:
. ~/.bashrc


From:
http://githowto.com/aliases
http://askubuntu.com/questions/17536/how-do-i-create-a-permanent-bash-alias

Add alias auto completion:
Now its time for adding the auto completion to your alias:

wget https://raw.githubusercontent.com/git/git/master/contrib/completion/git-completion.bash
mv git-completion.bash .git-completion.bash
vim .bash_profile

Add the following content to the file:
# add alies auto completion
source ~/.git-completion.bash
__git_complete gch _git_checkout
__git_complete gb _git_branch
__git_complete gmn _git_merge

Now just reboot shell and enjoy your auto completion :)

From:
http://stackoverflow.com/questions/342969/how-do-i-get-bash-completion-to-work-with-aliases