Reputation: 33701
We just set up a project with bitbucket. We put our 'production'[P] code on a repo, and then i created a fork[m] of it, and then my co-worker[C] also created a fork of it.
[P]
/ \
[M] [C]
I made some changes, and created a pull request and accepted it, so [P] now has my code, [M].
Here is where I am confused. How does [C], my coworkers repo get the updated code?
Thanks!
Upvotes: 5
Views: 187
Reputation: 1324347
Note: if we are actually talking about forking (which is the act of cloning a repo on the server side) and not simple cloning, then the schema is:
BitBucket
------------[P]-----------
| ^ |
| | |
(forked) (pull request) (forked)
| |
v v
[M] [C]
| |
----|------------------------|-----
| Local workstations |
| |
(git clone) (git clone)
| |
v v
[MLocal] [CLocal]
In other words, M
and C
are on the BitBucket servers, not on Muser
and Cuser
local workstations.
'origin
' would be their respective upstream repo of MLocal
and CLocal
, that is M or C, not P
.
(See "What is the difference between origin and upstream", for GitHub, but applies also for BitBucket)
This is useful for Muser because:
Muser
might not want to push directly to P
(he could though, he is the owner of P
on BitBucket), so here, repo M
acts as his "buffer"Cuser
has no right to push on P
, so he must to fork as wellIn that case, for Cuser
to see any updates on P
, he needs to add P
as a remote to CLocal
repo (ie his cloned local repo of his fork)
git remote add P https://bitbucket.org/Puser/P
git pull P master
Once those new changes are integrated and tested locally (on CLocal
), they can be pushed back to C
, along with new evolutions introduced by Cuser
. Only those new modifications will be part of a pull request, for Muser
(and P
owner) to examine and add to P.
Similarly, Muser
would need to add P
as a remote to MLocal
, in order to get back any modifications from C
that were accepted into P
.
Upvotes: 3
Reputation: 526613
Your coworker needs to pull from P.
If you're working on the master
branch in P, then the command would be...
git pull origin master
Upvotes: 9