Skip to content

Instantly share code, notes, and snippets.

View emeric-martineau's full-sized avatar

Emeric MARTINEAU emeric-martineau

View GitHub Profile
[alias]
co = checkout
br = branch
ci = commit
st = status
ss = status -s
l = log --graph --pretty=format:\"%C(yellow)%h%Creset%C(cyan)%d %cr%Creset %s %Creset%C(green)%an\"
lf = log --pretty=fuller
unadd = reset HEAD^
graph = log --graph --abbrev-commit --decorate --format=format:'%C(yellow)%h%C(reset)%C(auto)%d%C(reset) %C(normal)%s%C(reset) %C(dim magenta)%an%C(reset) %C(dim blue)(%ar) %C(reset)' --all
@emeric-martineau
emeric-martineau / alias-git.sh
Last active December 8, 2020 14:34
Prompt if you don't have push set upstream
#!/bin/bash
# Check only if git commit
if [ "$1" = "push" ]; then
__OK_COLOR="\e[42m"
__CANCEL_COLOR="\e[41m"
__NORMAL_COLOR="\e[m"
__BRANCH_COLOR="\e[33m"
__BRANCH=$(git rev-parse --abbrev-ref HEAD)
@emeric-martineau
emeric-martineau / alias-git-commit.sh
Created December 7, 2020 17:01
Funny script to replace git commit and change time of commit
#!/bin/sh
COUNTER_FILE="${HOME}/bin/.counter_date"
get_counter() {
# Read counter file
if [ -f "${COUNTER_FILE}" ]; then
# Check if file is same day that today
COUNTER_FILE_DATE=$(date -r "${COUNTER_FILE}" +"%Y%m%d")
CURRENT_FILE_DATE=$(date +"%Y%m%d")
@emeric-martineau
emeric-martineau / .bashrc
Last active April 7, 2020 12:59
Funny bash prompt with simple git support (display branch name)
function __show_git_repo_branch {
AFTER_HOOK="$1"
local CURRENT_BRANCH=$(git branch 2>/dev/null| grep -e '^*' | cut -b 3-)
if [ -n "${CURRENT_BRANCH}" ]; then
local IS_MODIFIED=$(git status --short | wc -l)
PS1+="${__GIT_COLOR}${__GIT_START_CHAR}${__GIT_BRANCH_COLOR}${CURRENT_BRANCH}"