Skip to content

Instantly share code, notes, and snippets.

View mmxcrono's full-sized avatar

Hoang Nguyen mmxcrono

View GitHub Profile
@mmxcrono
mmxcrono / .bashrc
Last active October 20, 2023 15:35
Add terminal colors, git branch name, convenient aliases to your ~/.bashrc file
View .bashrc
# --------------
# Functions
# --------------
# Parse branch name and format output
parse_git_branch() {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
# Switch to master or a new branch based on current one
@mmxcrono
mmxcrono / .vimrc
Last active October 20, 2023 15:29
Add some syntax highlighting and autoindex to your ~/.vimrc file
View .vimrc
set autoindent
syntax on
colorscheme koehler
@mmxcrono
mmxcrono / .gitconfig
Last active October 20, 2023 15:28
Add git aliases to your ~/.gitconfig file
View .gitconfig
[alias]
lg = !"git lg1"
lg1 = !"git lg1-specific --all"
lg2 = !"git lg2-specific --all"
lg3 = !"git lg3-specific --all"
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n''%C(white)%s%C(reset) %C(dim white)- %an%C(reset)'
lg3-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset) %C(bold cyan)(committed: %cD)%C(reset) %C(auto)%d%C(reset)%n'' %C(white)%s%C(reset)%n'' %C(dim white)- %an <%ae> %C(reset) %C(dim white)(committer: %cn <%ce>)%C(reset)'