Creating Git Aliases
I create shortcuts for everything. I create variables which act as text shortcuts, shortcuts in TextMate to generate CSS/JS/HTML, and bash scripts so I don't have to type in the same commands over and over again. So why should version control software be any different? I commit and push religiously so I create Git aliases to save myself a few keystrokes.
Sample Aliases
#make "com" alias for "commit"
git config alias.com commit
#make "co" alias for checkout
git config alias.co checkout
#make "br" alias for branch
git config alias.br branch
# When you want to see just the differences of one function in one file in two different commits
git config alias.funcdiff '!sh -c "git show \"\$1:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp1 &&
git show \"\$2:\$3\" | sed -n \"/^[^ \t].*\$4(/,/^}/p\" > .tmp2 &&
git diff --no-index .tmp1 .tmp2"' -
These are just some sample Git aliases. You can view more detailed (and by detailed I mean brain-numbing) examples of git aliases at the Git Wiki.
![9 More Mind-Blowing WebGL Demos]()
With Firefox OS, asm.js, and the push for browser performance improvements, canvas and WebGL technologies are opening a world of possibilities. I featured 9 Mind-Blowing Canvas Demos and then took it up a level with 9 Mind-Blowing WebGL Demos, but I want to outdo...
![Interview with a Pornhub Web Developer]()
Regardless of your stance on pornography, it would be impossible to deny the massive impact the adult website industry has had on pushing the web forward. From pushing the browser's video limits to pushing ads through WebSocket so ad blockers don't detect them, you have...
![MooTools Link Fading]()
We all know that we can set a different link color (among other properties) on the hover event, but why not show a little bit more dynamism by making the original color fade to the next? Using MooTools 1.2, you can achieve that effect.
The MooTools...
![Introducing MooTools Dotter]()
It's best practice to provide an indicator of some sort when performing an AJAX request or processing that takes place in the background. Since the dawn of AJAX, we've been using colorful spinners and imagery as indicators. While I enjoy those images, I am...
Nice! I use
ci
for commit though, more like Subversion. I also havedi
for diff,st
for status andsta
for stash.I’m trying to get the funcdiff alias created. When I try to call it with something like:
git funcdiff “rel\path\to\file” functionName
or
git funcdiff HEAD~2 HEAD “rel\path\to\file” functionName
both give me an error like:
fatal: Path ‘funcitonName’ does not exist in ‘sha1-2’.
fatal: Invalid object name ‘rel\path\to\file’.
I’ve Googled everywhere for anyone using this alias to see a sample syntax, but no one has one. Have you used it successfully?
You can make aliases for branch name, too. For example:
git symbolic-ref head HEAD
Dan, command
git symbolic-ref head HEAD
ruins git repo in windows. Because it overwrites “HEAD” with “head” in “.git” directory
For ones, that tried this: just rename the file back
Very useful, thanks!
Thanks for the commands,
I need to know how to create an alias for paths.
For example if I need to write “git push PATH” instead of “git push gitolite@codex…”
Regards