HOW-TO:Create add-on PRs using Git Subtree Merging: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(Created page with " == Guidelines == == Example git setup using Subtree merging == <pre> git clone [email protected]:xbmc/repo-plugins.git git remote add myaddon [email protected]:me/myaddon.git ...")
 
No edit summary
Line 8: Line 8:
<pre>
<pre>
git clone [email protected]:xbmc/repo-plugins.git
git clone [email protected]:xbmc/repo-plugins.git
cd repo-plugins
</pre>


For this example we will use an addon named "myaddon". Add the git repo where you addon resides as a remote:
<pre>
git remote add myaddon [email protected]:me/myaddon.git
git remote add myaddon [email protected]:me/myaddon.git
git fetch myaddon
git fetch myaddon
</pre>


Create a new branch for the addon:
<pre>
git checkout -b myaddon_branch myaddon/master
git checkout -b myaddon_branch myaddon/master
</pre>
The current directory should contain the files from the myaddon repository. To switch back to gotham branch of the "repo-plugins" repository:
<pre>
git checkout gotham
git checkout gotham
</pre>


First time setup if your addon already exist in repo:
'''Note:''' If your addon already exist in repo, remove it with:
<pre>
git rm -r plugin.my.addon/
git rm -r plugin.my.addon/
</pre>


Now we use subtree merge to pull myaddon into the gotham branch of repo-plugins:
<pre>
git read-tree --prefix=plugin.my.addon/ -u myaddon_branch
git read-tree --prefix=plugin.my.addon/ -u myaddon_branch
</pre>
The see the changes that are about to be committed:
<pre>
git diff --staged
git diff --staged
</pre>
Then commit the changes:
<pre>
git commit -m "[plugin.my.addon] 1.0.1"
git commit -m "[plugin.my.addon] 1.0.1"
</pre>
</pre>


=== Updates ===
=== Pulling Updates ===
 
Updating the addon is now easy. For this example we pull the master branch from myaddon:


<pre>
<pre>
git checkout gotham
git checkout gotham
git pull --strategy subtree --squash myaddon v1.0.2
git pull --strategy subtree --squash myaddon master
git diff --staged
git commit -m "[plugin.my.addon] 1.0.2"
git commit -m "[plugin.my.addon] 1.0.2"
git push origin gotham
git push origin gotham
</pre>
</pre>

Revision as of 13:59, 30 November 2014


Guidelines

Example git setup using Subtree merging

git clone [email protected]:xbmc/repo-plugins.git
cd repo-plugins


For this example we will use an addon named "myaddon". Add the git repo where you addon resides as a remote:

git remote add myaddon [email protected]:me/myaddon.git
git fetch myaddon


Create a new branch for the addon:

git checkout -b myaddon_branch myaddon/master

The current directory should contain the files from the myaddon repository. To switch back to gotham branch of the "repo-plugins" repository:

git checkout gotham

Note: If your addon already exist in repo, remove it with:

git rm -r plugin.my.addon/

Now we use subtree merge to pull myaddon into the gotham branch of repo-plugins:

git read-tree --prefix=plugin.my.addon/ -u myaddon_branch

The see the changes that are about to be committed:

git diff --staged

Then commit the changes:

git commit -m "[plugin.my.addon] 1.0.1"

Pulling Updates

Updating the addon is now easy. For this example we pull the master branch from myaddon:

git checkout gotham
git pull --strategy subtree --squash myaddon master
git diff --staged
git commit -m "[plugin.my.addon] 1.0.2"
git push origin gotham