In order for a pull request to be ready, it must have been:

Once a pull request is ready to be merged, the following is the process to use to merge into apache master.

Prerequisite 1 - Setting Up Your Github Environment

See https://git1-us-west.apache.org/

Prerequisite 2 - Setting Up Your Repo

Start with a clean clone of my personal fork of Metron

cd ~/Documents/workspace/metron/fork/committing

git clone git@github.com:james-sirota/incubator-metron.git


Add the apache repo as a remote repository


cd ~/Documents/workspace/metron/fork/committing/incubator-metron

git remote add apache https://git-wip-us.apache.org/repos/asf/incubator-metron.git


Sync apache with our github clone

cd ~/Documents/workspace/metron/fork/committing/incubator-metron

git pull apache master


 [If needed] Push changes to github clone

 git push


Merging the Pull Request: Gathering Information

Step 1 - Gather Information about the pull request

Now that we have a repo set up that is clean, we need to merge the pull request.  We want to squash the commits done as part of the PR so that we can keep the commits relatively isolated and uniform.  From the pull request page on github, you will need the following information:

  • The owner’s github username and email address
  • The pull request remote branch (Please do NOT do your development in the master branch of your github mirror of Metron)
  • The pull request number

First, look at the pull request.  It will look something like this:

Notice on the top of the page the pull request # is 50, user is merrimanr, and it's in a remote branch METRON-72 and has an associated   METRON-72 - Getting issue details... STATUS

Step 2 - Gather Information about the committer 


Finding the email address may be tricky because github tries to hide it from the web UI.  I sometimes clone the repo and do a git log to see the actual email:

cd /tmp

git clone --bare git@github.com:merrimanr/incubator-metron.git METRON-72

cd METRON-72

git log


Towards the top of the log you will notice:

Author: rmerriman <rmerriman@xxxx.com>
Date:   Fri Mar 18 12:49:31 2016 -0500

Step 3 - Merging the Pull Request: Pulling and Squashing

 

Now you can gather information, you can pull the remote branch from the PR’s clone into your local git repo via “git pull —squash git@github.com:USERNAME/incubator-metron.git BRANCH".  

First make sure you are on master 

cd ~/Documents/workspace/metron/fork/committing/incubator-metron

 

git checkout master

Checkout the PR. This should pull the changes into the current repo and not commit them. 

git pull --squash git@github.com:merrimanr/incubator-metron.git METRON-72 

Step 4 - Merging the Pull Request: Verifying

After a successful pull, you need to verify that the PR meets minimal standards after the merge.  Presumably more rigorous quality checks have been done before the vote was given on the PR, this is just to ensure minimal quality control.

mvn apache-rat:check && cd metron-streaming && mvn clean integration-test && cd ..


If this completed successfully, then we have ensured that:

  • Our Unit tests function
  • Our Integration tests function
  • Licenses are checked by apache-rat

Step 5 - Merging the Pull Request: Committing

From here, you can make the commit, ensuring that

  • The commit message is structured appropriately to close the PR
  • We have credited the user appropriately

The format for the commit message is as follows:

git commit --author=“PR_USER <PR_EMAIL>" -a -m “JIRA PR_REASON (PR_USER via YOUR_USER) closes apache/incubator-metron#PR_NUMBER

git commit --author="merrimanr <merrimanr@gmail.com>" -a -m "METRON-72 Create unified enrichment topology (merrimanr via jsirota) closes apache/incubator-metron#50"


You will get a message:

On branch master

Your branch is ahead of 'origin/master' by 1 commit.

Now that you’ve committed locally, you need to push to apache:

git push apache master


Step 6 - Merging the Pull Request: After Action

 

After committing a PR, you should remember to close the JIRA ticket associated with the PR





  • No labels