Skip to content

How to commit a patch

zw_yan edited this page Nov 16, 2022 · 8 revisions
  1. Create a PR
  2. Review the PR and check the all tests pass.
  3. Specify "Squash and merge" in the PR page and write commit messages.
  4. (option) If the patch need to be backpatched, you need to apply another branches.
# get the diff
$ git remote -v
origin  https://github.com/mikecaat/pg_rman.git (fetch)
origin  https://github.com/mikecaat/pg_rman.git (push)
oss     https://github.com/ossc-db/pg_rman.git (fetch)
oss     https://github.com/ossc-db/pg_rman.git (push)

$ git checkout ${the_branch_you_merged}
$ git pull --rebase oss ${the_branch_you_merged}
$ git log --oneline | head   # check the commit hash value

# apply another branches
$ git checkout ${another_branch_you_want_to_apply}
$ git pull --rebase oss ${the_branch_you_want_to_apply}
$ git cherry-pick ${commit_hash_value}

# Resolve if conflicts occurs
# fix conficts in your editor.
$ git status
$ git add ${the_resolved_files}
$ git cherry-pick --continue
$ git log --oneline | head   # check the commit hash value
$ # get the diff
$ git remote -v
origin  https://github.com/mikecaat/pg_rman.git (fetch)
origin  https://github.com/mikecaat/pg_rman.git (push)
oss     https://github.com/ossc-db/pg_rman.git (fetch)
oss     https://github.com/ossc-db/pg_rman.git (push)

# check the latest commit
$ git log --oneline | head
$ git diff HEAD^ HEAD

# apply the diff to the another branch
$ git push oss ${the_branch_you_want_to_apply}
Clone this wiki locally