3 ms·
Glad you like it. Another weird thing I do is that "g" is not just an alias, it's a function in my ~/.bashrc So "g" (without any argument) is "g status", with
by hayeah 16y ago
Glad you like it. Another weird thing I do is that "g" is not just an alias, it's a function in my ~/.bashrc
So "g" (without any argument) is "g status", with arguments, g is effectively an alias for git. A micro-optimization, true.
Another git feature I use quite a bit is the history rewrite. "git fuss 5" allows me to fiddle with the last 5 commits. I should write another article to explain git fuss. History rewrite sounds like a dirty thing. But my git workflow involves doing a whole bunch of temporary commits, so I can track small incremental steps with git. History rewrite is pretty legit for this usage pattern.
g() {
if [[ $# == '0' ]]; then
git status
else
case $1 in
fuss)
shift
git rebase -i HEAD~"$1";;
*)
git "$@";;
esac
fi
}
- dustingetz 16y ago> History rewrite sounds like a dirty thing well you're only rewriting local history, so you're a-ok. history re-writing becomes a dirty word when you re-write history that someone else may have already seen. i know you already know this.
- cpeterso 16y ago> history re-writing becomes a dirty word when you re-write history that someone else may have already seen. It seems like git (or some friendlier wrapper) could track this for you. For example, if you've pushed changes to a remote repo, then git could mark those changes as "published" in your local repo and warn you when you later try to rewrite that branch's history.
- zb 16y agoYou should try out Stacked Git, it provides a very easy way to deal with temporary commits. http://www.procode.org/stgit/ http://www.procode.org/stgit/