Using pre-commit hook

Paddle developers use pre-commit tool to manage git
pre-commit hooks. It can help us format source codes (cpp, python), check some
basic thing before commit (only one EOL for each file, do not add a huge file
in git). pre-commit tests is a part of unit tests in Travis-CI now, every
PR doesn't fit hook can not be merged into Paddle.

To use pre-commit, you should install it by
pip install pre-commit, and currently, Paddle uses clang-format to format
c/cpp sources. Please make sure clang-format 3.8+ installed.

Then just run pre-commit install in your Paddle clone directory. When you
commit your code, the pre-commit hook will check the local code if there is
anything not suitable to commit, and so on.

If there are no unique commits locally, git will simply perform a fast-forward.
However, if you have been making changes (in the vast majority of cases you
probably shouldn't be), you may have to deal with conflicts.

Push to GitHub

Pull Request

Go to the page for your fork on GitHub, select your development branch,
and click the pull request button.

Update your pull request with the lastest version

During the code review, your pull request may become stale because new commits in
baidu/Paddle. GitHub allows autmotic update if there is no conflict. You can do this
by clicking the "Update Branch" button in your pull request page. However, in the case
of conflict, you need to do the update manually. You need to do the following on
your local repository:

git checkout MY_COOL_STUFF_BRANCH
git pull upstream develop
# You may need to resolve the conflict according to the git prompt.# Make and test your code.
git push origin MY_COOL_STUFF_BRANCH

Now your Pull Request is updated with the latest version.

Revise your pull request

When you revise your pull request according to reviewer's comments, please use 'git commit' instead of 'git commit --amend' to commit your changes so that the reviewers can see the difference between the new pull requrest and the old pull request.