2008-12-15 00:30:54 +02:00
|
|
|
# Distributed Source Control Management
|
|
|
|
|
|
|
|
Unlike SVN, git does not used a central repository. This is why git is "distributed" and SVN is
|
|
|
|
"centralized". Although this makes git an extremely powerful system for collaborators, tracking
|
|
|
|
changes between various collaborators can quickly become difficult as multiple forks are created.
|
|
|
|
|
2009-02-24 05:26:59 +02:00
|
|
|
Please read the following before working with this code:
|
|
|
|
|
|
|
|
1. [Dealing with newlines](http://github.com/guides/dealing-with-newlines-in-git)
|
|
|
|
2. [Submitting changes from your fork](http://github.com/guides/fork-a-project-and-submit-your-modifications)
|
|
|
|
3. [Using SSH keys with github](http://github.com/guides/how-to-not-have-to-type-your-password-for-every-push)
|
|
|
|
|
2008-12-15 00:30:54 +02:00
|
|
|
## Managing Remote Repositories
|
|
|
|
|
|
|
|
First, you will need to tell git about the remote repository:
|
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
git remote add kohana git://github.com/kohana/kohana.git
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
This adds "kohana" as a remote repository that can be pulled from.
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
git checkout -b kohana/master
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
This creates a local branch "kohana/master" of the master branch of the "kohana" repository.
|
2008-12-15 00:30:54 +02:00
|
|
|
|
|
|
|
## Merging Changes from Remote Repositories
|
|
|
|
|
|
|
|
Now that you have a remote repository, you can pull changes into your local repository:
|
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
git checkout kohana/master
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
This switches to the previously created "kohana/master" branch.
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
git pull kohana master
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 07:07:21 +02:00
|
|
|
This pulls all of the changes from the remote into the local "kohana/master" branch.
|
2008-12-15 00:30:54 +02:00
|
|
|
|
|
|
|
git checkout master
|
|
|
|
|
|
|
|
This switches back to your local master branch.
|
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
git merge kohana/master
|
2008-12-15 00:30:54 +02:00
|
|
|
|
2009-11-09 06:57:07 +02:00
|
|
|
This merges all of the changes in the "kohana/master" branch into your master branch.
|
2008-12-15 00:30:54 +02:00
|
|
|
|
|
|
|
git push
|
|
|
|
|
|
|
|
This pushes all the merged changes into your local fork. At this point, your fork is now in sync
|
|
|
|
with the origin repository!
|