在本地,我可以在没有任何分支处于事件状态的情况下提交,即在 checkout 提交但不 checkout 分支之后。是否可以将不在任何分支中的提交推送到远程?
编辑:我只是想知道理论上 git 将如何处理推送“无分支”或仅推送分支。
最佳答案
当你这样做的时候
git push <remote> <source>:<destination>
<source>
可以是提交,是的。
<destination>
, 然而,有点棘手。从doc中取出:
It’s possible to push any type of object to any namespace outside of refs/{tags,heads}/. In the case of tags and commits, these will be treated as if they were the commits inside refs/heads/ for the purposes of whether the update is allowed.
所以基本上,您主要只推送到远程分支,但是是的,您可以推送提交,只要从当前引用移动到您正在推送的引用是快进 merge 。
关于git - 是否可以推送不在 git 任何分支中的提交?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55130311/