Difference between #4 and #9 of
Starting your Yii Project Reference Guide (with Git VCS in Linux)

Changes

Title unchanged

Starting your Yii Project Reference Guide (with Git VCS in Linux)

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

git, github, reference, guide, yii

Content changed

I've found useful to have a step by step reference guide to work with Git with most used commands, feel free to update it with useful information you may find interesting too. If you don't have Yii yet
 
 
Getting Yii from Github
 
-----------------------


```php
[...]
```


 
s
Working with your project
 
-------------------------
 
 
### S
tart your project 
 
(being at root folder)
[...]
```

i### Initialize git
[...]
m### Make git add empty directories to the repository
[...]
(source [https://gist.github.com/18780](https://gist.github.com/18780 "git script") )

### Adding third-party extensions
 
Adding a yii extension repository inside your repo at a specific path (e.g. we will add https://git.gitorious.org/lightopenid/lightopenid.git in 'protected/extensions/lightopenid')
[...]
```

To remove a submodule:
 
 
```php 
git rm --cached protected/extensions/lightopenid
 
```
 
 
### Ignoring files

Edit .gitignore file in root folder and add dirs/files you don't want to be in git repo
Use ! to negate the pattern:
[...]
```

Make your first commit
 
 
 
 
```php 
git commit -a "Initial ver
### Adding your own forked repo from github as an extension" ```
 
 
Now you are ready to go!
 
 
#Keep in mind some database design best practices
 
[http://www.yiiframework.com/wiki/227/guidelines-for-good-schema-design](http://www.yiiframework.com/wiki/227/guidelines-for-good-schema-design "Guidelines for good schema design")
 
 
#Use migration for tracking database changes
 
[http://www.yiiframework.com/doc/guide/1.1/en/database.migration](http://www.yiiframework.com/doc/guide/1.1/en/database.migration "")
 
 
If you want to add your forked repo from github ( i.e.: git@github.com:marcanuy/Comments-module.git ) from another repo (i.e.: git://github.com/segoddnja/Comments-module.git)  to the extensions directory, then:
 
 
 
```php 
git submodule add git@github.com:marcanuy/Comments-module.git protected/Comments-module
 
cd protected/extensions/Comments-module
 
git remote add upstream git://github.com/segoddnja/Comments-module.git
 
```php 
$yii/framework/yiic migrate create myNewTable
 
```
 
 
Update database with new migrations after updating your repo
 
 
 
```php 
$yii/framework/yiic migra

 
Then every time you wish to get latest updates from the original repo you should do:
 
 
```php 
cd protected/extensions/Comments-module
 
git pull upstream mas
ter ``` #Don't forget to secure your app
 
[http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/](http://www.yiiframework.com/wiki/275/how-to-write-secure-yii-applications/ "Secure your app")
 
## Make your first commit
 
 
 
 
```php 
git commit -a "Initial version"
 
```
 
 
Now you are ready to go!
16 0
12 followers
Viewed: 41 951 times
Version: 1.1
Category: Tutorials
Written by: marcanuy
Last updated by: marcanuy
Created on: Feb 20, 2012
Last updated: 12 years ago
Update Article

Revisions

View all history