git flow - 如何开始在现有功能分支上工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19638292/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:16:41  来源:igfitidea点击:

git flow - how to start working on existing feature branch

gitgit-flow

提问by FazoM

I would like to start working on another developer's feature branch (we use git and git flow). AFAIK The branch has been published (pushed). How can I get it to my local repository?

我想开始在另一个开发人员的功能分支上工作(我们使用 git 和 git flow)。AFAIK 该分支已发布(推送)。我怎样才能把它放到我的本地存储库?

I tried:

我试过:

git flow feature pull origin/XXXXXX-1003b

fatal: 'origin/XXXXXX-1003b' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Failed to pull from remote 'origin/XXXXXX-1003b'.

And:

和:

git flow feature pull XXXXXX-1003b

fatal: 'XXXXXX-1003b' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Failed to pull from remote 'XXXXXX-1003b'.

Please advise. Thanks

请指教。谢谢

回答by AD7six

git flow feature track

git flow 功能轨迹

To track an existing feature branch on a remote, use feature track:

要跟踪远程上的现有功能分支,请使用feature track

git flow feature track xxxxxx-1003b

Alternatively just do it "the normal way":

或者只是做“正常方式”:

git fetch origin
git branch -a # list all branches
git checkout feature/xxxxxx-1003b

I.e. update the remote origin, and then checkout the branch corresponding to your colleague's branch.

即更新远程源,然后签出与您同事的分支对应的分支。

回答by Pigueiras

If you don't have the branch inside your repo, and you want to get it, you have to use git-flow track. This should work:

如果你的 repo 中没有分支,而你想得到它,你必须使用git-flow track. 这应该有效:

git flow feature track XXXXXX-1003b

回答by Pigueiras

You can also use the feature/branch name(1):

您还可以使用功能/分支名称(1):

git flow feature track featurename

(1) Could be a new git flow feature, I respond to an old question.

(1) 可能是一个新的 git flow 功能,我回答了一个老问题。