git <https://github.com/civicrm/civicrm-core/> Core application which can be embedded in different systems (Drupal, Joomla, etc)
git <https://github.com/civicrm/civicrm-drupal/> Drupal integration modules. (Note: Each major release of Drupal has its own development branch; e.g. 7.x-4.3.x and 6.x-4.3.x would be branches for running CiviCRM 4.3 on Drupal 7 and Drupal 6, respectively)
Depending on the type of development you do, you may need to checkout
more or less code. For example, if you work with CiviCRM in multiple
...
...
@@ -154,13 +80,21 @@ lot of source-code; if you only use one environment and one language,
then you might instruct it to fetch less source-code. For more
instructions, run "gitify" (with no extra parameters).
<divclass="panelMacro">
+--+
| |
+--+
</div>
"git clone" vs "gitify"
If you're already familiar with git, then you've used "git clone" before. You're free to use "git clone" instead of "gitify". "gitify" is basically a wrapper that:
* Calls "git clone" for each of the CiviCRM repositories
* Optionally registers git-hooks in each of the CiviCRM repositories
* Calls "GenCode.php" to generate PHP stubs and data files
Skim the bottom of "gitify" to see the details.
Note: the dependencies repository name on Github does not have the same directory name as CiviCRM structure e.g. civicrm-packages -> packages when you clone a repository from the github the would be:
In the first case, we create the new branch "fancy-registration"; in the
second case, we update the existing branch "fancy-registration". In both
cases, "fancy-registration" builds on top of the latest
"upstream/master".
<divclass="panelMacro">
+--+
| |
+--+
Push Changes
</div>
In all the steps above, changes are saved on your local computer but aren't published for other developers to see. When you're ready to share the changes for a particular branch, you should "push" them. Simply run "git push origin <branch-name>". This will send a copy of all your branch to Github. Feel free to push as frequently or rarely as you want.
## Tip: Getting out of trouble
There is only one hard constraint: publish your changes (with "git push") before requesting review (with a "pull-request").
To understand what branches you have locally:
<divclass="code panel"style="border-width: 1px;">
<divclass="codeContent panelContent">
## Tip: Getting out of trouble
$ git branch
To understand what branches you have locally:
</div>
$ git branch
</div>
To prune branches on your local system that are tracking remote branches
that no longer exist:
<divclass="code panel"style="border-width: 1px;">
<divclass="codeContent panelContent">
$ git -p
$ git -p
</div>
</div>
To delete a branch on your local system:
<divclass="code panel"style="border-width: 1px;">
<divclass="codeContent panelContent">
$ git branch -d my_local_branch
$ git branch -d my_local_branch
</div>
</div>
If you changed a file and you have not git add'ed or committed it, but
want to discard your changes:
<divclass="code panel"style="border-width: 1px;">
<divclass="codeContent panelContent">
git checkout path/to/file
$ git checkout path/to/file
</div>
</div>
If you altered a file or files and you have git add'ed them or you just
want to blow away all un-committed changes in your repository:
<divclass="code panel"style="border-width: 1px;">
$ git reset --hard HEAD
<divclass="codeContent panelContent">
git reset --hard HEAD
</div>
</div>
If you committed to your local repository, but you have not pushed, and
you want to change your previous commit (or commit message):
<divclass="code panel"style="border-width: 1px;">
<divclass="codeContent panelContent">
# fix the file you want fixed
git add path/to/file/you/fixed
git commit --amend
fix the file you want fixed
</div>
$ git add path/to/file/you/fixed
$ git commit --amend
</div>
If you git pull and git tells you have a conflict with your local