Git Laravel project setup in to local computer

Step 1:

Create a database locally named as your project name or wish utf8_general_ci

forexample we are creating laravel_cms database name and its collation into utf8_unicode_ci


Step 2:

Download composer

Pull Laravel/php project from git provider.

or place of your project file into your directory.



Step 3:

Rename .env.example file to .env inside your project root and fill the database information. (windows wont let you do it, so you have to open your console cd your project root directory and run mv .env.example .env )

Step 4:

Open the console and cd your project root directory

>mv .env.example .env

$cp .env.example .env
$php artisan key:generate

to change .env.example file to .env file.


Step 5:

Setup your database setting in to project.

for command line

>vim .env

edit and set your database name, host, password



for my case i have these credential for the database system.


Step 6:


$composer install

$composer update


$php composer.phar install

it will create your vendor file for the laravel project.


Step 7:


$php artisan key:generate

It will create key for project CSRF token.


Step 8:


$php artisan migrate

it is for making table schema and its primary seeds(data) which are written in migration folder.


Step 9:


$php artisan db:seed to run seeders, if any.

Primary seeds(data) which are written in migration folder.


Step 10:


$php artisan serve


Create a new branch in git and manage these branches

In your github terminal or site, We need to keep our master branch clean, by clean I mean without any changes, like that you can create at any time a branch from your master. Each time that you want to commit a bug or a feature, you need to create a branch for it, which will be a copy of your master branch.

When you do a pull request on a branch, you can continue to work on another branch and make another pull request on this other branch.

Before creating a new branch, pull the changes from upstream. Your master needs to be up to date.

Create the branch on your local machine and switch in this branch :


$ git checkout -b [name_of_your_new_branch]

Change working branch :
$ git checkout [name_of_your_new_branch] Push the branch on github :
$ git push origin [name_of_your_new_branch] When you want to commit something in your branch, be sure to be in your branch. Add -u parameter to set upstream.

You can see all branches created by using :
$ git branch

Which will show :
* approval_messages
Add a new remote for your branch :
$ git remote add [name_of_your_remote] [name_of_your_new_branch]

Push changes from your commit into your branch :
$ git push [name_of_your_new_remote] [url]

Update your branch when the original branch from official repository has been updated :

$ git fetch [name_of_your_remote]

Then you need to apply to merge changes, if your branch is derivated from develop you need to do :
$ git merge [name_of_your_remote]/develop

Delete a branch on your local filesystem :
$ git branch -d [name_of_your_new_branch]

To force the deletion of local branch on your filesystem :
$ git branch -D [name_of_your_new_branch]

Delete the branch on github :
$ git push origin :[name_of_your_new_branch]

The only difference is the : to say delete, you can do it too by using github interface to remove branch :

If we want to change default branch, it’s so easy with github, in your fork go into Admin and in the drop-down list default branch choose what you want.