Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git pull and git push in one go

Tags:

git

dvcs

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

like image 673
shytikov Avatar asked Jun 22 '12 12:06

shytikov


People also ask

What is the shortcut command for fetch and merge in git?

So, unlike SVN, synchronizing your local repository with a remote repository is actually a two-step process: fetch, then merge. The git pull command is a convenient shortcut for this process.

What is commit push pull?

Commits are done locally. Push - pushing sends the recent commit history from your local repository up to GitHub. If you're the only one working on a repository, pushing is fairly simple. If there are others accessing the repository, you may need to pull before you can push.

What is push pull and fetch in git?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.


1 Answers

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

like image 124
lisachenko Avatar answered Oct 08 '22 16:10

lisachenko