[alias] justdoit = commit --amend --no-edit I feel like every other commit I forget something, so a `git j ` (I don't have any other aliases that what with j) puts my last minute fix where it belongs. Also nice during interactive rebases.
I use this a lot but I have a version with --no-verify to skip hooks too.
Ask HN: What are some Git aliases you setup that save you time?
21–30 of 35 posts
Yoy dirty, I hope Mr Gandalf pipeline, say the words!
Re: Ask HN: What are some Git aliases you setup that save you time?
#22[deleted]
Re: Ask HN: What are some Git aliases you setup that save you time?
#23I have a script checked into a git repo so I can more easily sync between machines.
https://gitlab.com/halcanary/config/-/blob/master/git_config...
Re: Ask HN: What are some Git aliases you setup that save you time?
#24`git standup` to dump my commits from yesterday, or Friday if today is Monday.
https://gist.github.com/ConorSheehan1/f6da062b536c633622e1aa...
Re: Ask HN: What are some Git aliases you setup that save you time?
#25[1] github-branch-open-pr - Open current branch as new PR in browser
[2] git-push-set-upstream - Push current branch to remote
And plenty more…
[1] https://github.com/benwinding/dotfiles/blob/master/bin/githu...
[2] https://github.com/benwinding/dotfiles/blob/2239e56df2a49818...
Re: Ask HN: What are some Git aliases you setup that save you time?
#26I have a bunch, but one of my favorite is a fish shell function that writes wip commits:
```
function w
#set --local staged (gs | cut -c1 | ag -v "\?" | string collect | string trim)
set --local staged (git status -s | grep "^[MADRCU]" | string collect | string trim)
if test -n "$staged"
#echo "something staged"
else
#echo "nothing staged"
git add .
end
if not string length -q -- "$argv"
gc -m 'WIP' -n
else
gc -m "$argv" -n
end
end```
Lifesaver and timesaver.
I have one called `b` that creates a new branch and commits.
One called `poop` that pushes the current branch to GitHub and create a PR.
etc etc
Re: Ask HN: What are some Git aliases you setup that save you time?
#27I commented elsewhere, but I also have
[alias]
unstash = stash pop
because I was used to perforce nomenclature. It's also a quick autocomplete since it's my only u... command.Re: Ask HN: What are some Git aliases you setup that save you time?
#28Re: Ask HN: What are some Git aliases you setup that save you time?
#29Here are a couple that I use a lot. There's probably a shorter way to write them:
# show the last 10 branches I used
lb = !git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | awk -F' ~ HEAD@{' '{printf(\" \\033[33m%s: \\033[37m %s\\033[0m\\n\", substr($2, 1, length($2)-1), $1)}'
# checkout the previous branch I was using
cop = !git checkout --recurse-submodules $(git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$1]++' | head -n 10 | grep -v $(git branch --show-current) | head -1 | cut -d' ' -f1)Re: Ask HN: What are some Git aliases you setup that save you time?
#30I commented elsewhere, but I also have [alias] unstash = stash pop because I was used to perforce nomenclature. It's also a quick autocomplete since it's my only u... command.
I have a similar one:
unstage = git restore --staged