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

From Official Kodi Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
== Example git setup using Subtree merging ==
== Example git setup using Subtree merging ==


=== First time setup ===
Clone the XBMC addon repository:
<pre>
<pre>
git clone [email protected]:xbmc/repo-plugins.git
git clone [email protected]:xbmc/repo-plugins.git
Line 40: Line 43:
</pre>
</pre>


The see the changes that are about to be committed:  
To see the changes that are about to be committed:  
<pre>
<pre>
git diff --staged
git diff --staged
</pre>
</pre>


Then commit the changes:
Finally, commit the changes:
<pre>
<pre>
git commit -m "[plugin.my.addon] 1.0.1"
git commit -m "[plugin.my.addon] 1.0.1"
git push origin gotham
</pre>
</pre>


=== Pulling Updates ===
 
=== Updating addon to a new version ===


Updating the addon is now easy. For this example we pull the master branch from myaddon:
Updating the addon is now easy. For this example we pull the master branch from myaddon:
Line 61: Line 66:
git push origin gotham
git push origin gotham
</pre>
</pre>
For more info about Subtree Merging see http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging

Revision as of 14:20, 30 November 2014


Guidelines

Example git setup using Subtree merging

First time setup

Clone the XBMC addon repository:

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, it must first be removed 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

To see the changes that are about to be committed:

git diff --staged

Finally, commit the changes:

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


Updating addon to a new version

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


For more info about Subtree Merging see http://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging