Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it safe to run other git commands while git push is running?

Tags:

git

git-push

When I've reached a point on a develop branch which I reckon is ready to deploy, I sometimes do the following:

git checkout master
git merge --no-ff develop --no-edit
# Latency occurs here
git push
git checkout develop
git merge --ff master
git push

While waiting for the first git push to happen, is it safe to open up a new terminal window and run the commands for checking out develop, merging in master, and pushing develop to the remote repository?

Related question: Is it safe to checkout a new git branch during the push of a current branch? , but it only talks about whether git checkout is safe.

like image 835
Andrew Grimm Avatar asked Oct 05 '16 05:10

Andrew Grimm


People also ask

What happens when you do git push?

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.

Is git checkout safe?

Yes, it is safe.

Does git push push other branches?

Push Branch to Another Branch In some cases, you may want to push your changes to another branch on the remote repository. In order to push your branch to another remote branch, use the “git push” command and specify the remote name, the name of your local branch as the name of the remote branch.

What does the flag mean in git push?

The -u flag is used to set origin as the upstream remote in your git config. As you push a branch successfully or up to date it, it adds upstream reference. As you push local branch with git push -u option, that local branch is linked with the remote branch automatically.


1 Answers

While waiting for the first git push to happen, is it safe to open up a new terminal window and run the commands for checking out develop, merging in master, and pushing develop to the remote repository?

Yes because master HEAD is not modified by the other operations: if there is any issue with the first git push, you will be able to retry it, with the same push with the same master HEAD.

In the meantime, that master HEAD can also be merged to develop.

But note that for concurrent pushes (on different branches), you will need to wait: the pushes are done sequentially.

like image 123
VonC Avatar answered Nov 15 '22 18:11

VonC