我想将另一个分支中存在的文件的不同版本加载到当前分支中。
git help checkout
says:
DESCRIPTION
Updates files in the working tree to match the version in the index or
the specified tree. If no paths are given, git checkout will also
update HEAD to set the specified branch as the current branch.
有没有办法签出所有这些文件,但是not更新头?
通过提供当前路径进行结账,.
:
git checkout other-branch-name -- .
这个操作类似于将 HEAD 切换到另一个分支而不检出文件 https://stackoverflow.com/questions/1282639/switch-git-branch-without-files-checkout,但只是从“另一个方向”。
正如@김민준提到的,这会覆盖任何未提交的更改。如果需要,请记住先将它们隐藏或提交到某个地方。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)