Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add Pro Git link.

Rules of Thumb

  • Every

tbd I need to sort this.

 

...

  • contribution is a piece of intellectual property. Please treat it with respect.

...

  • Preserve both the name and email address. This is the precious sustenance that nourishes our project.

...

  • Ensure your name and email address are there as the committer prior to pushing it to the Apache repositories.

...

  • Always give credit where it is due, ensure every merged commit reflects properly the individual who authored that commit.

...

Setting up Your Repository

If you are a new committer, please see Git at Apache how to personalise git for easy committing.  If you are new to git, see the 'Quick git primer' section below.

Clone the canonical ASF repo using this command.

...

 

...

...

 <yourRepoName>

 

Merging from a patch file

Save the patch from the Github patch link (just append .patch to the pull request link to get it). This patch will keep the authorship of the commit, so we should use it instead of the diff.  Apply the patch preserving the original author:

cd <yourRepoName>
git co master
git pull
git apply foo.patch
git add -u
git commit -F ../your.logmessage
git push

Quick git primer for workflow

Assumes you have already cloned the git, and are going to start working on a patch.

Never work directly in master, every commit in master must be tested by running dftest.

In order to work, and have local commits (like "finished 1part, going out for lunch"), use the following recipe:

 

cd <yourRepoName>
git co master
git pull
git branch -b work

<do all your work, including several small commits>

git commit -a -F ./your.logmessage
<continue working>
<run dtest -plain to ensure all test cases still work>

 

git co master
git merge --squash work
git commit -a -F ../your.logmessage
git push

 

Additional Information

Particularly                   <p>Add a second remote, for the GitHub repository.</p>
                  <div class="panel">git remote add github https://github.com/apache/incubator-corinthia.git</div>
                  <p>For the GitHub remote, add an additional fetch reference which will cause every pull request to be made available as a remote
                  branch in your workspace.</p>
                    <div class="panel">git config --local --add remote.github.fetch '+refs/pull/*/head:refs/remotes/github/pr/*'</div>
                   <p>Finally, run git fetch --all to update from all remote repositories - you will see all the pull requests appear:</p>
                   <div class="panel"> [new ref]         refs/pull/98/head -> github/pr/98
                   * [new ref]         refs/pull/99/head -> github/pr/99</div>
                <h3>Merging a pull request</h3>
                   <p>Fetch the latest remote branches, which will cause a remote branch for the PR to become available to you.
                   <div class="panel">git fetch --all</div>
                   If you want to inspect the PR and/or run tests, check out the branch:
                       <div class="panel">git checkout github/pr/1234</div>
                <p>To perform the merge, first update your master branch to the latest:</p>
                     <div class="panel">git checkout master   git pull --rebase</div>
                   <p>Then merge and push:</p>
                   <div class="panel">git merge --no-ff -m 'This closes #1234' github/pr/1234 git push apache master</div>
                   <p>Note that this commit message is important, as this is what will trigger the pull request to be automatically closed, and the --no-ff means that a
                   merge commit will always be created.</p>
               <h3>Alternative options</h3>
              <h4 class="subheader">Adding the remote reference to the contributor’s repository</h4>
              <p>Fetch the branch of the user you want to merge from
              <div class="panel">git fetch https://github.com/user-to-merge-from/incubator-corinthia.git branch-to-merge-from</div>
            <p>If you commonly merge from a particular user, you’ll want to add their repo as a remote to make fetching branches easier.</p>
             <div class="panel">git remote add user-to-merge-from https://github.com/user-to-merge-from/incubator-corinthia.git
             <br> git fetch user-to-merge-from</div>
               <h3>Merging from a patch file</h3>
             <p>Save the patch from the Github patch link (just append ‘.patch’ to the pull request link to get it). This patch will keep the authorship of the
            commit, so we should use it instead of the diff. Apply the patch preserving the original author:</p>
             <div class="panel">git am pull-request-9876.patch</div>
             <h3>Additional information</h3>
             <p>Particularly for new committers, you may find the following information useful:

 </p>
                 <ul>
                      <li>Guide for new project committers</li>
                     <li>Committers FAQ</li>
                     <li>Git at Apache</li>
                </ul>
          </div>
      </div>