Search code examples
gitgit-push

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


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.


Solution

  • 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.