Is it safe to checkout a new git branch during the push of a current branch?

亡梦爱人 提交于 2019-12-12 11:08:06

问题


For example, if I am pushing master to a remote repo and it's taking a while, is it safe to open another terminal and do git checkout secondbranch so I can start working again? Is the original process doing the push going to be disrupted by the new checkout?


回答1:


It should be safe, because push is reading from your local repo and writing to the remote, and checkout is reading from your local repo and writing to your workspace.

Nice visualization of what-goes-where: http://www.ndpsoftware.com/git-cheatsheet.html#loc=local_repo;




回答2:


Yes, it is safe.

Push is separate concept from the working directory and the checked-out branch. You can actually push and fetch from the .git directory of your repo (or any bare repo for that matter). That shows, at a high level, the two aspects of the application are well isolated.

With that being said, always make backups of your data.



来源:https://stackoverflow.com/questions/11715379/is-it-safe-to-checkout-a-new-git-branch-during-the-push-of-a-current-branch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!