Git Pills – A sync alias command to pull and push in one shot

Using Git is generally a joy, but sometimes you find yourself in need to shorten some steps. Fortunately there are git aliases,  which allows you to shorten existing commands, or even make your own.


As you may know, I’m a C# developer, so I spent my day by day life using another lovely tool, Visual Studio. Starting from Visual Studio 2013, Microsoft included a full Git support, and I can say that is not bad at all; on the contrary, I find it quite useful and well integrated:

Visual Studio 2013 with Team Explorer Git integration

Visual Studio 2013 with Team Explorer Git integration

One of the most useful thing in Git plugin for VS2013 is the Sync feature: when you have to check remotes for new commits to pull and then push your commits, you need only to click on the Sync button:

Visual Studio 2013 Sync feature

Visual Studio 2013 Sync feature

I use that button all the time in VS2013, so I tried to look at something similar for the Git Bash console; I’m not so good at writing Bash scripts, so I googled for a solution better than my original trial, and I found a good Gist from Nicky Leach on GitHub.

If you put that alias in your git config, than you can achieve the same result even from the Bash shell:

Hope this helps :)

Ciao,
Nando :)

2 thoughts on “Git Pills – A sync alias command to pull and push in one shot

Leave a Reply to Ferdinando Santacroce Cancel reply

Your email address will not be published. Required fields are marked *