Open dorawyy opened 6 years ago
base branch
can still be changed, but the head branch
cannot be changed
Commit merge
in Github merge tool, this will merge the entire base branch into your head branch (pull request branch)
git checkout lcoal_branch
git fetch origin git merge origin remote_branch
git pull origin remote_branch
Anyone with push access to the repo can complete the merge.
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.
(as can be seen from the screenshot above, forbids fast-forward merging with --no-ff
param)
An inactive pull request is one whose owner has either stopped responding, or, more likely, has deleted their fork.
If a fork was deleted, the pull request can still be merged. However, if you want to make changes to a pull request and the author is not responding, you'll need to perform some additional steps to update the pull request.
Once a pull request is opened, GitHub stores all of the changes online for you. In other words, commits in a pull request are available in a repository even before the PR is merged. That means you can fetch an open pull request and recreate it as your own
Anyone can work with a previously opened pull request to continue working on it, test it out, or even open a new pull request with additional changes. However, only collaborators with push access can merge pull requests.
Step1: find the ID number of the inactive pull request.
Step2: In terminal, fetch reference to the pull request based on ID, creating a new branch in the process
# format:
git fetch origin pull/ID/head:BRANCH
# example:
git fetch origin pull/60/head:PullRequest60
Step3: checkout a branch based on the pull request
# format:
git checkout BRANCH
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.
--no-ff
param:
git checkout BaseBranch
git merge HeadBranch --no-ff
all commits from the head branch (or pull request branch) are added onto the base branch individually without a merge commit
Requirement:
The rebase and merge behavior on GitHub deviates slightly from git rebase.
You aren't able to automatically rebase and merge on GitHub when:
If you still want to rebase the commits but can't rebase and merge automatically on GitHub you must:
Every repository contains a Compare view, which allows you to compare the state of your repository across branches, tags, commits, time periods, and more. The compare view provides you with the same diff tooling that the Pull Request view does.
To get to the compare view, append /compare
to your repository's path.
Link to the compare view of the current repo: https://github.com/dorawyy/git-merge-conflicts-test/compare
Every repository's Compare view contains two drop down menus: base
and compare
.
base
should be considered the starting point of your comparison, and compare
is the endpoint.
During a comparison, you can always change your base
and compare
points by clicking on Edit.
compare
drop down menu at the top of the page.compare
drop down menu.octocat:master
for base and octo-org:master
for compare, you can compare the master branch of the repositories respectively owned by octocat
and octo-org
.@
, and then the date wrapped between a { }
notation. For example, typing master@{2weeks}
into the base
dropdown menu compares the current master
branch against the master
branch as it was two weeks prior.YYYY-MM-DD
(year-month-day).^
notation to mean "one commit prior."96d29b7^^^^^
indicates five commits prior to 96d29b7
, because there are five ^
marks. Typing 96d29b7^^^^^
in the base
branch and 96d29b7
in the compare
branch compares the five commits made before 96d29b7
with the 96d29b7
commit.Here's an example of a comparison using the ^ notation.
Answer:
The developer has to manually uncheck this to disable push access from upstream repo's collaborator
Create a pull request
Changing the branch range and destination repository
Pull request from a fork
Defining the mergeability of pull requests
protected branch
status check