- Users: desktop, laptop
- Branches:
master,desktop,laptop
-
desktop create README.md file and create first commit: 'Initial Commit'
-
desktop push to master
git push --set-upstream origin master -
This should be the first and last time commit is directly pushed to branch
origin/master -
Protect branch
masterby enabling 'Require pull request reviews before merging' -
Add laptop user as Collaborator
-
Create and switch to branch
desktopgit checkout -b desktop -
Create 2 files with 3 lines each:
people.md,cars.md -
Commit the 2 files as '#desktop - create new files: people and cars'
-
Push to origin
git push --set-upstream origin desktop -
Create pull request '#desktop - create new files: people and cars'
-
laptop accept collaborator invitation
-
Clone remote repo
git clone git@github.com:ijklim/git-multi-users-pull-request.git -
Create and switch to branch
laptopgit checkout -b laptop -
Create 2 files with 3 lines each:
people.md,fruits.md -
Commit the 2 files as '#laptop - create new files: people and fruits'
-
Push to origin
git push --set-upstream origin laptop -
Create pull request '#laptop - create new files: people and fruits'
- desktop approves pull-request from laptop '#laptop - create new files: people and fruits'
- desktop merge pull-request into branch
master - Status of pull-request '#desktop - create new files: people and cars' changes
-
Commit screenshots and README.md changes to branch
desktopas '#desktop - add screenshots and update README' -
Switch to
master, pull from remote origingit checkout mastergit pullResult:
Updating 2471afd..6e0febc Fast-forward fruits.md | 3 +++ people.md | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 fruits.md create mode 100644 people.mdgit log --onelineResult:
6e0febc (HEAD -> master, origin/master) Merge pull request #2 from ijklim/laptop c94164a (origin/laptop) #laptop - create new files: people and fruits 2471afd Initial commit -
Switch back to
desktopand attempt to pull changes from localmastergit checkout desktopgit log --onelineResult:
a4d8c19 (HEAD -> desktop) #desktop - add screenshots and update README 41f3b80 (origin/desktop) #desktop - create new files: people and cars 2471afd Initial commitgit merge masterResult:
Auto-merging people.md CONFLICT (add/add): Merge conflict in people.md Automatic merge failed; fix conflicts and then commit the result. -
With merge conflict, cancel merge and use rebase instead
git merge --abortgit merge rebase masterResult:
First, rewinding head to replay your work on top of it... Applying: #desktop - create new files: people and cars error: Failed to merge in the changes. Using index info to reconstruct a base tree... Falling back to patching base and 3-way merge... Auto-merging people.md CONFLICT (add/add): Merge conflict in people.md Patch failed at 0001 #desktop - create new files: people and cars The copy of the patch that failed is found in: .git/rebase-apply/patch Resolve all conflicts manually, mark them as resolved with "git add/rm <conflicted_files>", then run "git rebase --continue". You can instead skip this commit: run "git rebase --skip". To abort and get back to the state before "git rebase", run "git rebase --abort". -
Fix conflict in file
people.mdand continuegit add people.mdgit rebase --continue -
Push to remote
desktop, use flag --force to overridegit push --force
-
laptop approve pull-request '#desktop - create new files: people and cars'
-
laptop merge pull-request '#desktop - create new files: people and cars'
-
Switch to
master, pull changes from remote origingit pullgit log --onelineResult:
f9edf4b (HEAD -> master, origin/master, origin/HEAD) Merge pull request #1 from ijklim/desktop 73d8382 (origin/desktop) #desktop - add screenshots and update README a0f435d #desktop - create new files: people and cars 6e0febc Merge pull request #2 from ijklim/laptop c94164a (origin/laptop, laptop) #laptop - create new files: people and fruits 2471afd Initial commit -
Switch to
laptopand pull changes frommastergit checkout laptopgit log --onlineResult:
c94164a (HEAD -> laptop, origin/laptop) #laptop - create new files: people and fruits 2471afd Initial commitgit merge mastergit log --onlineResult:
f9edf4b (HEAD -> laptop, origin/master, origin/HEAD, master) Merge pull request #1 from ijklim/desktop 73d8382 (origin/desktop) #desktop - add screenshots and update README a0f435d #desktop - create new files: people and cars 6e0febc Merge pull request #2 from ijklim/laptop c94164a (origin/laptop) #laptop - create new files: people and fruits 2471afd Initial commit
- All branches are now all in sync


