不用拉就可以结帐吗? [英] Git pull without checkout?
问题描述
我习惯从我正在处理的分支中运行git pull和其他命令.但是我已经建立了一个开发服务器,可以由几个人工作,所以我不想在执行此操作时不必切换分支.如果我想从我们都使用的github存储库中更新开发服务器上的现有分支,那么正确的方法是什么?如果我运行命令"git pull github branchname",是否会将分支拉入当前分支?
I'm used to running git pull and other commands from within a branch I'm working on. But I have set up a development server that several people work on, so I don't want to have to switch branches when I do it. If I want to update an existing branch on the dev server from the github repository we all use, what would be the right way to do that? If I run the command 'git pull github branchname' will that simply pull the branch into the current branch?
我能找到的所有git示例似乎都表明您先运行'checkout branchname',然后再执行pull.我正在努力避免这种情况.正如我所说的,这是一个现有分支,我只想更新到最新版本.
All of the git examples I can find seem to indicate that you run 'checkout branchname' first, then do the pull. I'm trying to avoid that. As I said, this is an existing branch and I just want to update to the latest version.
推荐答案
我一直在寻找相同的东西,最后在另一个stackoverflow帖子中找到了对我有用的答案:
I was looking for the same thing and finally found the answer that worked for me in another stackoverflow post: Merge, update, and pull Git branches without using checkouts
基本上:
git fetch <remote> <srcBranch>:<destBranch>
这篇关于不用拉就可以结帐吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!