...
Essentially, there are not big differences but you have to be aware that you are working now with three repositories. What is nice working in remote mode is that all your work will be stored on git-hub, you can create your own branches to keep any experimental/prototyping work you may want and in the same time to share it with everyone on git-hub
...
In order to set-up such environment follow below steps
...
- Create an account on git-hub and add open-source repository (free)
- From git-hub project page, fork Douglas's project into your own repository
- Create ssh keys on both sides: local and on your git account(to prepare your local clone): http://www.question-defense.com/2009/02/04/add-a-ssh-key-to-your-github-account-for-a-linux-server
- Clone your project in read/write mode
Commands:
Code Block |
---|
...
git clone git@github.com:mirceac/ |
...
sipxecs.git
In git terms, your remote repository is called: origin and Douglas's is called: upstream
At this point you have tracked only your repository (origin)
run: git remote (or git remote -v)
return: origin
5. Verify your branches created locally:
git branch
it may return only master. master-4.2 branch may be hidden. In order to show this branch too run:
git branch -a
In order to switch to hidden branch run: git checkout -b master-4.2 origin/master-4.2
run once again:
git branch
and you will see both master and master-4.2 branches
5. Track upstream remote repository (Douglas's):
git remote add upstream git://github.com/dhubler/sipxecs.git (note the read-only url, there is no chance to write on upstream)
Run again git remote
return: origin
upstream
6. Get upstream
git fetch upstream
7. In order to keep in sync the upstream repository (Douglas's) and origin repository (yours) run:
git fetch upstream
git merge upstream/master
8. Assuming you have done some development on your clone on branch master and you want to push changes in your repo on git-hub:
Move to the branch you want to push on git-hub (master or master-4.2)
Assuming that you developed on branch topic, merge topic branch with the current one (the one you moved on):
git merge topic
Perform push on git-hub:
git push origin master (git push origin master-4.2 if you have your changes in master-4.2 branch)
9. If you cannot perform a merge operation you can cancel it by running:
git reset --hard
...
//At this point you have tracked only your repository (origin)
git remote (or git remote -v)
return: origin
|
Track upstream remote repository (Douglas's):
Code Block |
---|
git remote add upstream git://github.com/dhubler/sipxecs.git (note the read-only url, there is no chance to write on upstream)
git remote
return: origin
upstream
|
...
In order to keep in sync the upstream repository and origin repository (yours)
...
Code Block |
---|
git checkout master-4.2 //move to master-4.2 branch
git fetch upstream //get latest code from upstream
git rebase upstream/master-4.2 //rebase your local master-4.2 branch repository with upstream
git status //to verify if your local branch has something that needs to be pushed to origin
git push origin +: //push on origin
|
NOTE: +: means that during rebase you may need to do some manual merging and your local git history may become different than origin git history and you need force push
Assuming that you developed on branch TEST, follow below steps to push them on origin
- Perform any commit/rebase operation as explained above
- Merge changes on your local master-4.2 repository
- Push your master-4.2 repo on origin
Commands:
Code Block |
---|
git checkout master-4.2 //move to master-4.2 branch
git rebase TEST //push TEST changes on top of your master-4.2 branch
git push origin +: //push your local master-4.2 branch on origin
|
Send your changes upstream: From your project's page, click the "pull request" button
The upstream owner may accept or may reject your commit
Some documentation links:
...