Kodi Community Forum
GitHub best practices - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: GitHub best practices (/showthread.php?tid=141893)



GitHub best practices - mika91 - 2012-10-03

Hi,

I succesfully made a personal Eden Build with some patches, but now I'd like to:
  • Create a Github repository
  • Keep it synchronized with xbmc/xbmc repository
  • Create an Eden+patches branch
  • Compile every day the last nightly, with my patches added.

So I tried the "fork" command in GitHub.
I now have a  mika91/xbmc, repository but it isn't synchronized with xbmc/xbmc. I don't have the last commits in master branch for example.
How can I achieve this?

And for compiling each day the last nighlty with my patches, what is the best way?

thanks



RE: GitHub best practices - Montellese - 2012-10-03

You need to add the xbmc/xbmc repo as a remote repository (we call it "upstream") to your local git repo (there's a tutorial on github for that). Then you need to run "git fetch upstream" and in your master branch you need to run "git pull upstream master" to get the latest commits from xbmc/xbmc. Then you create a new branch based on your master branch and apply your patches. Everytime you want to synchronise your repository with xbmc/xbmc you need to run "git pull --rebase upstream master" to get the latest commits from xbmc/xbmc, apply them to your branch and re-apply all your patches on top of them. Then you can do your build.

Are these patches very "personal" or could they be useful for other people as well? In case of the latter feel free to create a pull request on github with your patches/changes.


RE: GitHub best practices - mika91 - 2012-10-03

oh, thanks for the very quick answer!
I'm using only few patches found on the forum: DXVA HQ Scalers and PGS Forced Subtitles
I'm quite happy with both, and I'll check tonight if pull request are not already done for these.


RE: GitHub best practices - Martijn - 2012-10-03

(2012-10-03, 15:35)mika91 Wrote: oh, thanks for the very quick answer!
I'm using only few patches found on the forum: DXVA HQ Scalers and PGS Forced Subtitles
I'm quite happy with both, and I'll check tonight if pull request are not already done for these.

If creating PR always do this in a branch of master. This way you can update master branch and rebase the working branches on top of that


RE: GitHub best practices - mika91 - 2012-10-03

(2012-10-03, 15:39)Martijn Wrote:
(2012-10-03, 15:35)mika91 Wrote: oh, thanks for the very quick answer!
I'm using only few patches found on the forum: DXVA HQ Scalers and PGS Forced Subtitles
I'm quite happy with both, and I'll check tonight if pull request are not already done for these.

If creating PR always do this in a branch of master. This way you can update master branch and rebase the working branches on top of that

I think I need to read a good tutorial/Ebook about GIT.
It seems very powerful but quite complicated...
Only using non-distributed repository at work (subversion and clearcase), ^^




RE: GitHub best practices - Martijn - 2012-10-03

(2012-10-03, 15:43)mika91 Wrote:
(2012-10-03, 15:39)Martijn Wrote:
(2012-10-03, 15:35)mika91 Wrote: oh, thanks for the very quick answer!
I'm using only few patches found on the forum: DXVA HQ Scalers and PGS Forced Subtitles
I'm quite happy with both, and I'll check tonight if pull request are not already done for these.

If creating PR always do this in a branch of master. This way you can update master branch and rebase the working branches on top of that

I think I need to read a good tutorial/Ebook about GIT.
It seems very powerful but quite complicated...
Only using non-distributed repository at work (subversion and clearcase), ^^

I highly recommend SmartGIT (<- very very easy to use GUI for git)
http://www.syntevo.com/smartgit/index.html
It's free to use for non commercial use

On Github site there are very good how-to guides that read easy. I started that way myself just did it step by step.
Using SmartGIT makes life so much more easy.




RE: GitHub best practices - mika91 - 2012-10-03

ok.
I played with git and smartGit tonight.
Let's see what I have done:
  • recreated my xbmc/xbmc fork, named mika91/xbmc
  • Clone mika91/xbmc repository to a local one
  • Add remote repository xbmc/xbmc to local rep.

So now, If I want to keep my online repository synchronized, I have to pull xbmc/xbmc localy, then push to mika91/xbmc ?
Or there is a way without localy pull/push)?

For my workflow, I switch to xbmc/master branch, right?
Then I add my patches localy, and push all in a mika91/master+mypatch branch?
And every night, I will pull xbmc/master into my working branch, and then push it back into mika91/master+mypatch

I continue playing and learning Git Wink



RE: GitHub best practices - jmarshall - 2012-10-04

Start by reading the git parable:

http://tom.preston-werner.com/2009/05/19/the-git-parable.html

I'd highly recommend using git on the command line, so you get to know exactly how it works.

To maintain a patch branch you:

1. Branch off upstream/master and switch to it:

git branch patched_upstream upstream/master
git checkout patched_upstream

2. Apply your patches via git am, or via patch + git commit.

3. Build.

To update your patched branch to whatever new and shiny thing is in upstream/master your goal is to bring the unpatched bit of your branch up to date, but still have your patches applied on top of the result. This can be achieved by fetching the changes from upstream, then rebasing your branch onto the updated master from upstream so that your changes are top-most:

git fetch upstream
git rebase upstream/master

Alternatively this can be done via git pull --rebase upstream master

Cheers,
Jonathan