John Livermore
John Livermore

Reputation: 31313

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?

Upvotes: 0

Views: 207

Answers (2)

floppyears
floppyears

Reputation: 11

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.

Upvotes: 1

Marty Cortez
Marty Cortez

Reputation: 2343

Try git push --all origin or git pull --all origin

Upvotes: 2

Related Questions