HOW-TO:Update a pull request to an official addon repository on GitHub: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Created page with "A pull request (PR) to an official addon repository (for scripts, plugins or other) on GitHub must have exactly one commit. This is necessary to keep clean commit history in t...")
 
No edit summary
Line 1: Line 1:
A pull request (PR) to an official addon repository (for scripts, plugins or other) on GitHub must have exactly one commit. This is necessary to keep clean commit history in the repo with each commit representing a single addon addition or update. However, you may be asked to make some changes into your PR before it will be submitted. But any further updates will create new commits that you will need to squash into one. This is how to do it in the most simple way:
A pull request (PR) to an official addon repository (for scripts, plugins or other) on GitHub must have exactly one commit. This is necessary to keep clean commit history in the repo with each commit representing a single addon addition or update. However, you may be asked to make some changes into your PR before it will be submitted. The following procedure allows you to update your PR without creating a new commit:


1. Make all necessary changes in your addon PR.
1. Make all necessary changes in your addon PR.
Line 6: Line 6:


  git add .
  git add .
  git commit -a --fixup=HEAD
  git commit -a --amend --no-edit


This will create a new "fixup" commit with the title like in your initial commit but with "fixup!" prefix.
3. Push your changes to GitHub. Since you have rewritten the commit history you need to use <code>--force</code> option:
 
3. Start interactive git rebase:
 
git git rebase -i --autosquash HEAD~2
 
This command will open a text editor (vim) where you need to edit your commit history. But because you have made a "fixup" commit on the previous step, you don't really need to edit anything, so proceed to the next step.
 
4. Press <code>ESC</code> to enter a command mode in the editor, type the following command to save changes and quit:
 
:wq
 
(a colon, "w" and "q"). Now press <code>Enter</code>. Git will squash your "fixup" commit with the previous one.
 
5. Push your changes to GitHub. Since you have rewritten the commit history you need to use <code>--force</code> option:


  git push -f
  git push -f


Now you PR will be updated and you still have one commit in the PR.
Now you PR will be updated and you still have one commit in the PR.

Revision as of 16:11, 14 July 2017

A pull request (PR) to an official addon repository (for scripts, plugins or other) on GitHub must have exactly one commit. This is necessary to keep clean commit history in the repo with each commit representing a single addon addition or update. However, you may be asked to make some changes into your PR before it will be submitted. The following procedure allows you to update your PR without creating a new commit:

1. Make all necessary changes in your addon PR.

2. Commit your changes to the PR branch using the following commands:

git add .
git commit -a --amend --no-edit

3. Push your changes to GitHub. Since you have rewritten the commit history you need to use --force option:

git push -f

Now you PR will be updated and you still have one commit in the PR.