Search code examples
gitdvcs

git pull and git push in one go


Is it possible to have git pull and git push in one git command?

The syntax like git pull & git push doesn't suit me completely, since I need to provide my credentials to the server twice: on pull and on push.

So I wondering, is there any workaround for this? I believe it should be, since it's pretty common case when developer pulls remote origin before pushing local changes.

EDIT: I'm using Windows 7/x64, msysgit-utf8 1.7.9


Solution

  • First of all, you can configure _netrc file that will be used by Git, here is the related issue: Git - How to use .netrc file on Windows to save user and password Then you can configure an alias for the command:

    git config alias.publish '!git pull && git push'
    

    And just type: git publish