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.
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.
Yes, it is safe.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With