Last active
November 20, 2021 09:06
-
-
Save stijn-dejongh/b55e91a775b6b6e95fbbc5d529132a87 to your computer and use it in GitHub Desktop.
Linux && Git Aliases
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # TEXT aliases | |
| alias v="vim" | |
| alias em="emacs" | |
| # GIT ALIASES | |
| alias g=git | |
| alias glog="git lg" | |
| alias gsquash="git squash" | |
| # PRODUCTIVITY ALIASES | |
| alias inspire="fortune oblique" | |
| # KEYBOARD ALIASES | |
| alias workman="setxkbmap us; xmodmap ~/xmodmap/xmodmap.workman && xset r 66" | |
| alias qwerty="setxkbmap us; xset -r 66" | |
| alias colemak="setxkbmap us -variant colemak" | |
| # MAVEN ALIASES | |
| alias mci="mvn clean install" | |
| alias mi="mvn install" | |
| alias mrprep="mvn release:prepare" | |
| alias mrperf="mvn release:perform" | |
| alias mrrb="mvn release:rollback" | |
| alias mdep="mvn dependency:tree" | |
| alias mpom="mvn help:effective-pom" | |
| alias mst="mci -Dmaven.test.skip=true" | |
| alias msonar='mci -Psonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login="$SONAR_KEY"' | |
| # DOCKER ALIASES | |
| alias dockerps="docker ps --format 'table {{.ID}}\t{{.Image}}\t{{.Status}}\t{{.Names}}'" | |
| # Bash aliases | |
| alias breload="source ~/.bashrc" | |
| # HELP functions | |
| function git-help-base() { | |
| echo "Git Custom Aliases Usage" | |
| echo | |
| echo " g = git" | |
| echo | |
| echo "-- # General usage " | |
| echo " g squash = squash latest [N] commits together" | |
| echo " g lg = minimal git log" | |
| echo " g c = git commit ALL" | |
| echo " g wip = quick commit" | |
| echo " g amno = ammend no edit" | |
| echo " g amend = ammend + update message" | |
| echo " g work = Status of last days for Daily Huddles" | |
| echo " g info = Branch Info" | |
| } | |
| export -f git-help-base | |
| function git-help-branches() { | |
| echo | |
| echo "-- # Branches " | |
| echo " g p = push local branch to origin" | |
| echo " g rr = rebase on upstream master" | |
| echo " g n = create new branch" | |
| echo " g co = checkout" | |
| echo " g st = status " | |
| echo " g rv = revert file" | |
| echo " g cleanup = reset local branch to be identical to remote" | |
| echo | |
| echo "-- # Ignoring files" | |
| echo " g ignore = ignore file" | |
| echo " g unignore = unignore file" | |
| echo " g ignored = list ignored files" | |
| } | |
| export -f git-help-branches | |
| function git-help() { | |
| git-help-base && git-help-branches | |
| } | |
| export -f git-help | |
| alias ghelp="git-help" | |
| function maven-help() { | |
| echo "Maven Custom Aliases Usage" | |
| echo | |
| echo " mci = mvn clean install" | |
| echo " mi = mvn install" | |
| echo " mrprep = mvn release:prepare" | |
| echo " mrperf = mvn release:perform" | |
| echo " mrrb = mvn release:rollback" | |
| echo " mdep = mvn dependency:tree" | |
| echo " mpom = mvn help:effective-pom" | |
| echo " mst = mvn clean install -Dmaven.test.skip=true" | |
| echo | |
| } | |
| export -f maven-help |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # General git usage | |
| squash = "!f(){ git reset --soft HEAD~${1} && git commit --edit -m\"$(git log --format=%B --reverse HEAD..HEAD@{1})\"; };f" | |
| lg = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
| c = "!git add -A && git commit -m " | |
| wip = "!git add -A && git commit -m 'WIP commit - quick save'" | |
| amno = "!git add -A && git commit --amend --no-edit" | |
| amend = "!git add -A && git commit --amend" | |
| work = !git lg --author \"Stijn\" --before today --after \"two days ago\" --no-merges | |
| info = !git st && echo && git lo && echo && git remote -v | |
| # Handling files that are to be assumed unchanged. | |
| ignore = update-index --assume-unchanged | |
| uningore = update-index --no-assume-unchanged | |
| ignored = !git ls-files -v | grep '^[a-z]' | |
| # Branches | |
| p = "!git push origin $(git rev-parse --abbrev-ref HEAD)" | |
| rr = "!git fetch --all && git rebase origin/master" | |
| n = "!git checkout -b" | |
| co = "!git checkout" | |
| st = "!git status" | |
| rv = "!git checkout --" | |
| cleanup = "!git reset --hard && git clean -f" | |
| # Stashes | |
| isl = "!git stash list" | |
| sa = "!git stash apply" | |
| ss = "!git stash save" | |
| # Diffs | |
| dt = difftool --no-prompt | |
| mt = mergetool --no-prompt | |
| # Tags | |
| lstags = "!f(){ echo 'Describe: '; git describe; echo 'Latest 5 tags: '; git tag | sort -V | tail -5; }; f" | |
| colt = "!f(){ local latest=`git tag | sort -V | tail -1`; git checkout $latest; }; f" | |
| # Read aliases | |
| alias = "config --get-regexp 'alias.*'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment