简单的Git工作流程

时间:2014-10-17 20:27:18

标签: 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希望开发newbranch

git checkout newbranch
git pull newbranch

DevB对newbranch进行更改并将更改推送到原点

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.

有人可以告诉我这里有什么问题吗?

2 个答案:

答案 0 :(得分:2)

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

答案 1 :(得分:1)

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

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

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

相关问题