adding merge-PR script to help merging Pull Requests
This commit is contained in:
parent
e85bb3ca4a
commit
230aba76a2
|
@ -88,7 +88,40 @@ Here are the basic commands to retrieve pull requests, merge, and push them to t
|
|||
|
||||
$ git push apache master
|
||||
|
||||
#### Notes:
|
||||
## Rebasing before you merge
|
||||
|
||||
If the pull request gets too behind master, it would be better to rebase the branch before merging it.
|
||||
You can do that by either asking the author of the pull request to do such rebase (what is not always possible) or you could do it yourself during merging.
|
||||
|
||||
In case you rebase the pull request it is mandatory that write "This closes #105" Where 105 is the pull request ID.
|
||||
|
||||
There is a script that helps doing such thing at <project root>/scripts/merge-PR.sh.
|
||||
|
||||
The script is assuming you have defined remotes named at upstream, apache and origin like specified previously here.
|
||||
|
||||
to execute such script simply use:
|
||||
|
||||
```
|
||||
$ <checkout-directory>/scripts/merge-pr.sh <PR number> Message on the PR
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/checkouts/apache-activemq-artemis
|
||||
|
||||
$ ./scripts/merge-pr.sh 175 ARTEMIS-229 address on Security Interface
|
||||
```
|
||||
|
||||
The previous example was taken from a real case that generated this [merge commit on #175](https://github.com/apache/activemq-artemis/commit/e85bb3ca4a75b0f1dfbe717ff90b34309e2de794).
|
||||
|
||||
- After this you can push to the canonical Apache repo.
|
||||
```
|
||||
$ git push apache master
|
||||
```
|
||||
|
||||
## Notes:
|
||||
|
||||
The GitHub mirror repository (i.e. `upstream`) is cloning the canonical Apache repository. Because of this there may be
|
||||
a slight delay between when a commit is pushed to the Apache repo and when that commit is reflected in the GitHub mirror.
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you under the Apache License, Version 2.0 (the
|
||||
# "License"); you may not use this file except in compliance
|
||||
# with the License. You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing,
|
||||
# software distributed under the License is distributed on an
|
||||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
# KIND, either express or implied. See the License for the
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
|
||||
|
||||
# this script assumes the following remote entries on your config
|
||||
#
|
||||
# - origin being your github fork:: https://github.com/YOU/activemq-artemis.git
|
||||
# - upstream being the github fork for apache:: https://github.com/apache/activemq-artemis.git
|
||||
# - apache being the apache origin:: https://git-wip-us.apache.org/repos/asf/activemq-artemis.git
|
||||
#
|
||||
# Notice: you should add +refs/pull/*/head to your fetch config on upstream
|
||||
# as specified on https://github.com/apache/activemq-artemis/blob/master/docs/hacking-guide/en/maintainers.md
|
||||
|
||||
git fetch origin
|
||||
git fetch apache
|
||||
git checkout apache/master -B master
|
||||
git fetch upstream
|
||||
git checkout upstream/pr/$1 -B $1
|
||||
git pull --rebase apache master
|
||||
git checkout master
|
||||
git merge --no-ff $1 -m "This closes #$*"
|
||||
git branch -D $1
|
Loading…
Reference in New Issue