alias.coffee !f(){ if [ $(date -j +%a) = 'Fri' ]; then echo 'Friday! Time for beer!'; else echo 'Time for a coffee break. Go get a cup of joe.'; fi };f
An alias for a quick status:
alias.st status -s -uno
An alias to do a diff with my configured difftool:
alias.d difftool
An alias to use kdiff3 to display my changes in my branch from master:
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
I'd suggest dropping the -j on your date command. It doesn't need to be there because you're not setting a date, and it's not compatible with GNU date, so it won't work on 99% of servers.
This requires fzf to be installed but allows you to fuzzy find and check out a git branch. Really useful when you don't remember the branch name exactly but have an idea of what it might be.
He/Him/His
I'm a Software Engineer and a teacher.
There's no feeling quite like the one you get when you watch someone's eyes light up learning something they didn't know.
This is disgusting and I don't recommend it, but I compile my Linux kernels from source when they are released on my Gentoo system:
alias kernclean='make clean && make distclean && make mrproper'alias dokern='cd /usr/src/linux && kernclean && make && mount /boot && make install && grub-mkconfig -o /boot/grub/grub.cfg && emerge -avt @module-rebuild && umount /boot && cd -'
Must be run as root, and assums the user has already utilized eselect kernel to chose their desired kernel version. This symlinks the source to usr/src/linux.
This was my "first draft" and now its years later and I've been using it about once a week without touching it. I have a similar shindig for cleanup of old kernel artifacts but I couldn't quite pack it into an alias, it's got its own function.
I keep feeling like i should revisit this whole setup but it...keeps working fine.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
I've been a professional C, Perl, PHP and Python developer.
I'm an ex-sysadmin from the late 20th century.
These days I do more Javascript and CSS and whatnot, and promote UX and accessibility.
An alias to show my aliases:
alias.alias config --get-regexp ^alias\.
An alias to make a branch, with a date suffix:
alias.mkbr !f(){ local args="$*"_; local gituser=$(git config user.email); gituser=${gituser%@*}; if [ "$args" = "_" ]; then args=""; fi; args=${gituser:-${USER}}/$args$(date "+%Y-%b-%d"); args=$(echo "$args" | tr ' [A-Z]' '_[a-z]'); git checkout -b "$args"; };f
An alias to delete a branch:
alias.rmbr !f(){ git branch -d "${1}"; git push origin --delete "${1}"; };f
An alias to go to master:
alias.master checkout master
An alias to get coffee:
alias.coffee !f(){ if [ $(date -j +%a) = 'Fri' ]; then echo 'Friday! Time for beer!'; else echo 'Time for a coffee break. Go get a cup of joe.'; fi };f
An alias for a quick status:
alias.st status -s -uno
An alias to do a diff with my configured difftool:
alias.d difftool
An alias to use kdiff3 to display my changes in my branch from master:
alias.d3master difftool --tool kdiff3 --dir-diff origin/master..
A bash shell alias to do a git log of just the branch's first parent:
alias log=git log --pretty=oneline --graph --max-count=$(( $LINES / 2 )) --first-parent --use-mailmap --date=format:%Y-%b-%d\ %H:%M --pretty=format:'\''%C(red)%h%C(reset) -%C(yellow)%d%C(reset) %C(green)%cd %C(bold blue)%aN%C(reset) %s'\'' --abbrev-commit
I'd suggest dropping the
-j
on yourdate
command. It doesn't need to be there because you're not setting a date, and it's not compatible with GNU date, so it won't work on 99% of servers.Here is my list of
git
aliasI really like these:
get = !git pull --ff-only
- lets me rungit get
to only pull fast forward changeswho = shortlog -n -s --no-merges
- this is more of a fun one. Shows a list of who has committed to the project and how many commits they have madeA complicated one
This requires
fzf
to be installed but allows you to fuzzy find and check out a git branch. Really useful when you don't remember the branch name exactly but have an idea of what it might be.Here are mine:
Shorthand for using git (bash/zsh alias):
alias g=git
Undo the last commit:
undo = reset --soft HEAD^
Get a summary of commits since yesterday (useful during standups):
standup = !"git log --reverse --branches --since=$(if [[ "Mon" == "$(date +%a)" ]]; then echo "friday"; else echo "yesterday"; fi) --author=$(git config --get user.email) --format=format:'%C(cyan) %ad %C(yellow)%h %Creset %s %Cgreen%d' --date=local"
Push to origin:
pp = push origin
Force push to origin:
ppf = push origin --force-with-lease
Pretty log:
lol = log --pretty=format:"%C(yellow)%h\\ %Cblue%G?%Cred%d\\ %Creset%s%Cgreen\\ (%cr)%Cblue\\ [%cn]" --decorate --graph
This is a must have on my
.bashrc
:These are from the oh-my-zsh git plugin:
github.com/robbyrussell/oh-my-zsh/...
Not strictly a git alias, but I have a bash alias
gclone <repo>
that clones the repo andcd
s into the directory.This is disgusting and I don't recommend it, but I compile my Linux kernels from source when they are released on my Gentoo system:
Must be run as root, and assums the user has already utilized
eselect kernel
to chose their desired kernel version. This symlinks the source tousr/src/linux
.This was my "first draft" and now its years later and I've been using it about once a week without touching it. I have a similar shindig for cleanup of old kernel artifacts but I couldn't quite pack it into an alias, it's got its own function.
I keep feeling like i should revisit this whole setup but it...keeps working fine.
Here's mine.
My Git Aliases
Nick Taylor ・ Aug 25 '18 ・ 5 min read
alias gpc='git push --set-upstream origin "$(git-branch-current 2> /dev/null)"'
if you don't have anything, this would suffice alone. i always forget how to push my new branch to remote...
ud = "!f() { git checkout develop && git pull origin develop; }; f"
lbranch = "!f() { git rev-parse --abbrev-ref @{-1}; }; f"
udrcb = "!f() { git ud && git checkout $(git lbranch) && git rebase develop; }; f"
one for lazy remote tracking of the current branch
alias.hug merge --ff-only
My standard response:
The case against aliases
Ben Sinclair ・ Sep 3 '18 ・ 1 min read
I used to love the alias's that ship with Oh-my-zsh, then I found magit