How to submit patches - Cidana-Developers/Cidana-Task-Manager GitHub Wiki

How to submit patches

Update to the latest code

git pull

Switch to a new branch if necessary:

$ git branch new_branch
$ git checkout new_branch

Create patches

Make sure follow the coding style and naming conventions;

Apply clang-format to modified .c, .h and .cc files

Before pushing changes for review, you should format your code with:

clang-format -i --style=file \
      $(git diff --name-only --diff-filter=ACMR '*.[hc]' '*.cc'

Some Git installations have clang-format integration. Here are some examples:

# Apply clang-format to all staged changes:
$ git clang-format

# Clang format all staged and unstaged changes:
$ git clang-format -f

# Clang format all staged and unstaged changes interactively:
$ git clang-format -f -p

Submitting patches

First, push it to another branch, then propose a pull request to UnitTests branch.

$ git commit
$ git push

You may need to push local new branch to the remote repository:

$ git push origin new_branch:new_branch # replace new_branch with your own new branch

Propose the pull request

You can follow Creating a Pull Request.

Incorporating reviewer comments

If you previously uploaded a change to Github and the Approver has asked for changes, follow these steps:

  1. Edit the files to make the changes the reviewer has requested.
  2. Recommit your edits by using the --amend flag, for example:
$ git commit -a --amend  

--amend opens up the interactive commit message environment you are used to from git commit. Change the message as you see fit; you’ll see your edits are now actually part of the commit, too. When you save (:wq again), it will register that a new commit has been logged.

  1. Force push to your branch
git push -f origin

The pull request will update to your latest code.

Delete the branch after it's merged into other branch.

No need to keep old branch once it's merged into master or other branch.

$: git branch -d old_branch