dorawyy / git-merge-conflicts-test

This repo is for testing of git functionalities / different merging conflict scenarios, and CI tools usage
2 stars 4 forks source link

[concept] Rationale for Github pull request #67

Open dorawyy opened 6 years ago

dorawyy commented 6 years ago

Create a pull request

Pull request from a fork

dorawyy commented 6 years ago

Findings

dorawyy commented 6 years ago

Addressing merge conflicts in pull request

Types of merge conflicts

About merge conflicts

Resolving a merge conflict on GitHub

Resolving a merge conflict using the command line

fetch & merge

git fetch origin git merge origin remote_branch

or pull directly

git pull origin remote_branch

dorawyy commented 6 years ago

Merging a pull request

Anyone with push access to the repo can complete the merge. screen shot 2017-11-10 at 5 59 16 pm

If the pull request does not have any merge conflicts, you can merge it on Github. If the pull request does have merge conflicts, or if you'd like to rest the changes before merging, you can check out the pull request locally and merge it using the command line.

If you decide you don't want the changes in a topic branch to be merged to the upstream branch, you can close the pull request without merging.

screen shot 2017-11-10 at 5 47 58 pm

Checking out pull requests locally

Modifying an inactive pull request locally

With issueID/ pull request ID, anyone can recreate all commits inside belonging to the issue/pull request

example:

git checkout PullRequest60


**Details of Pull Request #60:**
![1510366664050](https://user-images.githubusercontent.com/16771854/32685312-8bb2376a-c643-11e7-821b-eed4d26f8242.jpg)
**Commits containing inside Pull Request #60:**
<img width="1161" alt="screen shot 2017-11-10 at 6 21 01 pm" src="https://user-images.githubusercontent.com/16771854/32685340-f8c6c21c-c643-11e7-8d5a-0d4e2f8aeeb5.png">
**Commits of the newly created branch `PullRequest60`(corresponding to pull request #60):**
![wx20171110-183038](https://user-images.githubusercontent.com/16771854/32685407-5c97f652-c645-11e7-9c05-cb57804280da.png)
**Comparing with commits history of `PR1`(base branch of the pull request):** 
<img width="948" alt="wx20171110-183541 2x" src="https://user-images.githubusercontent.com/16771854/32685446-61ecc640-c646-11e7-91af-81c8e88a26b7.png">

* Step4: Now, you can do anything you want with this branch. You can run some local tests, or merge other branches into it, including `master`. **Make any modifications!**

* Step5: When ready, you can push the branch to remote, and create a new pull request from it.
dorawyy commented 6 years ago

Merging a pull request on GitHub

Merge all of the commits into the base branch

Squash and merge your pull request commits

Rebase and merge your pull request commits

dorawyy commented 6 years ago

Comparing commits across time (Compare View)

Comparing branches

Comparing tags

Comparing commits

Comparing across forks

Comparisons across time

Comparisons across commits

Here's an example of a comparison using the ^ notation.

dorawyy commented 6 years ago

By default, can original repo's owner push to fork (both public)?

Answer:

Here are the details:

1. Original repo's colalborators can propose commits to the fork, all commits they proposed will go via pull requests

wx20171117-095341 2x

1510941456960

2. Then transferring to the compare view (comparing the patch branch on original repo and the branch you want to commit to of the fork repo

wx20171117-100332 2x

3. All commits will be made in the committer's own repo (original repo in this testcase), via checking out a new patch branch

wx20171117-100615 2x wx20171117-100654 2x wx20171117-100723 2x
dorawyy commented 6 years ago

By default, the pull request would grant upstream repo's owner push access to the fork repo branch

wx20171117-101947

The developer has to manually uncheck this to disable push access from upstream repo's collaborator