简单的Git工作流程



我在用Git设置看似简单的工作流程时遇到了问题。

假设我有两个开发人员,DevA和DevB。有一个名为"origin"的远程存储库,两个开发人员都可以访问。

DevA从"master"创建分支。。。

git checkout -b 'newbranch'

DevA对newbranch进行更改并提交

git add .
git commit -m 'newbranch changes'

DevA推动对原始的更改

git push --all

DevB想要分支

git fetch --all

DevB希望开发新的

git checkout newbranch
git pull newbranch

DevB对新分支进行更改,并将更改推送到原始

git add .
git commit -m 'message'
git push --all

DevA需要从远程获取更改并获取。。。

git checkout newbranch
git pull --all
You asked to pull from the remote '--all', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.

然后。。。

git branch -r
origin/newbranch
origin/HEAD -> origin/master
origin/master

然后。。。

git pull origin/newbranch
fatal: 'origin/newbranch' does not appear to be a git repository
fatal: Could not read from remote repository.

有人能告诉我这里出了什么问题吗?

尝试git push --all origingit pull --all origin

我可能错了,但我认为当您使用git pull --all时,它认为--all是远程存储库的名称。

我认为DevA只需要做:git pull origin newbranch

另一种选择是使用git fetch origin,然后DevA可以使用git merge origin/newbranch手动进行合并。

最新更新