Shorten various frequently used git aliases:
sdoesgit statusresetdoesgit reset --hardreset <file>doesgit checkout <current branch> <file>co <branch>doesgit checkout <branch>. You can tab autocomplete these branches.comto quickly checkout master.cob <branch>doesgit checkout -b <branch>(make a branch)gfdoesgit fetchgbdoesgit branch(see your branches)clone <git username> <repo name>shortensgit cloneby not requiring the URL (though you canclone <URL>if you want to). Also, willcdinto the directory automatically. (Use clone -d to not cd automatically.)
Create new omnibus commands by merging things together:
- Whenever you checkout a branch, git status is run automatically.
cop <branch>will checkout, pull, and then do git status. ( copmforcop master)cobm <branch>will make a new branch called, but will checkout master and pull first (so you branch off of master) rb(ruby bundle) will runbundle install,bundle exec rake db:migrate,bundle exec rake db:test:prepare, andbundle exec rake db:seedrp(ruby pull) willgit pullandgit fetch, but then run ruby bundle.corp <branch>will checkout(co) and then ruby pull (rp). co + rp = corp. corbm <branch>is likecobm, but with a ruby pull on master instead of a regular pull. Useful for making new branches in ruby projects.backmergewill backmerge master by checking out master, pulling master, checking out your previous branch, andgit merge origin/masterthat branch.ruby_backmergewill dobackmerge, except withrbrun first.backmerge_allwill iterate over all the git branches in your repo and backmerge master into them.rebasestarts agit rebaseof master into the current branch. Continue interactively and make changes.continue_rebasewill iterate to the next commit.end_rebasewhen all commits are complete to force push changes into the current branch.difshows you the output of bothgit diffandgit status.prune <branch>will delete that branch both locally and on git.oldbrancheslists the 10 oldest branches. Useoldbranches xto list the x oldest branches (e.g.,oldbranches 20for the latest 20).unmergedtells you what branches are not yet merged.plogshows the git log, but prettier.deploywill runbin/deployif the file exists, orgit push heroku masterotherwise.release <tag>will automatically release (git tag+git push) with that tag.
No changes are made to anything involving git commit, git push, or git pull, because these functionalities are turbocharged by Send.zsh and Send.vim.
Why use this instead of the "git" plugin?
Oh-my-zsh already has a git plugin you can optionally install that has aliases.
I obviously prefer my plugin better -- it has alias names that make more sense to me, and it has more complex aliases that make working on things much easier (especially Ruby projects with built in bundle and migrate), and stuff like autopush on new branch is really neeat. But if you don't work with Ruby and don't like some of the style choices I made (though feel free to suggest options for futher customizations, see above), you might prefer that plugin instead.
Why can't I use them both?
Pick a side, we're at war!
But in seriousness, I think if you use them both (include both in your plugin line), nothing crashes and they don't interfere much with each other. You'll be able to use the custom commands both here and there (i.e., both gco and co will work to do git checkout) and nothing in either plugin overwrites functionality of the other plugin.
Help! Tab completion isn't working for branch names like you said!
First, I think this only works in Zshell, so if you're not using Zshell, then that's your first problem.
If you are using Zshell and things aren't working, you have to mess with your settings. If you have either autoload -U compinit && compinit or setopt completealiases in your .zshrc, remove them.
If that doesn't work, you may have to include unsetopt completealiases in your .zshrc because it is being set somewhere else. Though doing this may break the functionality of a different plugin, so watch out and choose wisely!
If the problem still persists, it's a problem I haven't encountered myself yet. File an issue and I can take a look!
If you like this, you might also likeβ¦
- Send.zsh, a git command by robertzk that combines
git add .,git commit -a -m, andgit push origin <branch>. - Send.vim, a vim plugin by me to do the above without leaving vim.
- Git-it-on.zsh, git commands to open files on GitHub from the command line.