Git » History » Version 2
Adam Sutton, 2013-02-01 11:50
1 | 1 | Adam Sutton | h1. Git for TVH Dummies |
---|---|---|---|
2 | |||
3 | As I get quite a few people asking me what the right way to work with git is, in particular in relation to submitting patches upstream, I thought it might be a good idea to write a quick wiki entry to help with some common tasks. |
||
4 | |||
5 | I'm also fairly new to git, I'd only touched it occasionally before getting involved in Tvheadend, but I've now been using it solidly for about a year. So while I'm by no means an expert, I'll at least point out some of the things I've learnt over that year. |
||
6 | |||
7 | h2. Github |
||
8 | |||
9 | Tvheadend hosts its primary repository on "github":https://github.com, this is a useful community site as not only does it provide basic git hosting but also some useful tools for managing the project. This includes the ability for users to create public forks, submit Pull Requests (PRs) and to comment on commits and other things. |
||
10 | |||
11 | The main project page can be found at https://github.com/tvheadend/tvheadend. |
||
12 | |||
13 | If you don't intend to actively contribute to the development you can simply clone the repository for the purpose of [[Building]] and the rest of this article is probably not relevant. However should you later decide you do want to push stuff back upstream then there are some useful hints below. |
||
14 | |||
15 | h2. Forking |
||
16 | |||
17 | The first thing you should do if you intend to actively develop and push features/fixes upstream is to create a public fork on "github":https://github.com (you can use other services, but it won't fit as well with the general project workflow and the [[Team]] may get grumpy!). |
||
18 | |||
19 | 2 | Adam Sutton | To create the fork simply click on the fork icon: !fork.png! |
20 | |||
21 | This will create a new personal fork on github, which will allow you to publish your own changes etc. |
||
22 | |||
23 | You will also need to add an SSH key to your account to be able to push changes to your fork. If you're unsure how to do this please visit the "github ssh help page":https://help.github.com/articles/generating-ssh-keys. |
||
24 | |||
25 | Once that is all done you should create a clone of your repository using the SSH access URL (this will give you push access): |
||
26 | |||
27 | !clone.png! |
||
28 | |||
29 | <pre> |
||
30 | git clone [email protected]:USERNAME/tvheadend.git |
||
31 | </pre> |
||
32 | |||
33 | h3. Fixing upstream clone |
||
34 | |||
35 | If you have already cloned the upstream (tvheadend/tvheadend.git) repository and now want to create you're own github fork, while still retaining your local repository (possibly with commits you've already made). First create the github fork as above, and instead of cloning that repository do the following within your existing local repository: |
||
36 | |||
37 | <pre> |
||
38 | git remote rename origin upstream |
||
39 | git remote add origin SSH_URL |
||
40 | git fetch origin |
||
41 | git branch --set-upstream master origin/master |
||
42 | </pre> |