You don’t want to waste time manually typing out long commands every time you use Git version control.
Let’s turn this common command:
git push origin masterInto this:
git pomIf you don’t have a .gitconfig already, open up your Terminal and run this command:
touch ~/.gitconfigYou should now have an empty .gitconfig file at /users/youraccount/.
Open .gitconfig
Now open your .gitconfig file with this command:
open ~/.gitconfigYou might already have some configuration in this file, such as:
[user]
email = youremail@gmail.com
name = John
[github]
user = usernameIf you don’t, I suggest you add it to your gitconfig file now (using your own information).
Create git alias
Now let’s create a git alias for git push origin master.
Move to a new line and add this:
[alias]
pom = push origin masterYour .gitconfig file should look similar to this:
[user]
email = youremail@gmail.com
name = John
[github]
user = username
[alias]
pom = push origin masterNow when you run git pom in your Terminal, it will automatically run push origin master for you.
Make more git aliases
You can use this blueprint to create all types of alias/shortcut commands for Git. For example, let’s say you want to use git s instead of git status. Simple, just add it below your other aliases:
[user]
email = youremail@gmail.com
name = John
[github]
user = username
[alias]
pom = push origin master
s = statusLess typing is always good!