简体   繁体   中英

Simple Git workflow

I am having trouble setting up a seemingly simple workflow with Git.

Say I have two developers, DevA and DevB. There is a remote repository called 'origin' that both developers have access to.

DevA creates a branch from 'master'...

git checkout -b 'newbranch'

DevA makes changes to newbranch and commits

git add .
git commit -m 'newbranch changes'

DevA pushes the changes to origin

git push --all

DevB wants the branches

git fetch --all

DevB wants to work on newbranch

git checkout newbranch
git pull newbranch

DevB makes changes to newbranch and pushes changes to origin

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

DevA needs to get changes from remote and gets...

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.

then...

git branch -r

origin/newbranch
origin/HEAD -> origin/master
origin/master

then...

git pull origin/newbranch

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

Can someone tell me what is wrong here?

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

I might be wrong here, but I think when you used git pull --all it thought --all was the name of your remote repository.

I think DevA just needs to do: git pull origin newbranch .

Another option would be to use git fetch origin and then DevA could manually do the merge using git merge origin/newbranch .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM