Setting up Laravel project with Git Setting up Laravel project with Git laravel laravel

Setting up Laravel project with Git


Laravel default app (https://github.com/laravel/laravel.git) doesn't change much and when it changes, Taylor gives the steps to migrate it. What you really want to do is to keep your project in sync with https://github.com/laravel/framework.git, for that you just have to

composer update

Every day.

But if you really want to have default app in sync too, here are some steps:

1) Go to github and fork https://github.com/laravel/framework.git.

2) Install your application as you would normally:

composer create-project laravel/laravel your-project-name --prefer-dist

3) Rename git origin to anything else:

git remote rename origin laravel

4) Create a new project on github and add it as your new origin

git remote add origin https://github.com/you/yourproject.git

5) Add, commit and push it:

git add -Agit commit -m "first commit"git push origin master

And you should be good to go.

Every time you need to merge yours with Laravel's you'll probably need to:

1) Fetch the changes

 git fetch laravel

2) Take a look at the list of branches:

git branch -va

3) Merge yous with laravel

git merge laravel/master


How to Setup a Remote Repository with your Laravel Projects:

Create a "remote" repository either using github, bitbucket, etc. Make sure that the repository your creating is "empty" meaning literary empty don't include any Readme.md yet.

Create your laravel project file:
$ composer create-project --prefer-dist laravel/laravel my-app
then cd my-app to the project's root folder.

Git Initilization:

$ git init
$ git remote add <name-of-remote> <remote-path>
ex: git remote add origin https://github.com/youraccount/my-app.git
$ git add .
$ git commit -m "Initial Commit"
$ git push origin master

then, check out your "remote repository" if your commits are reflected.

Next step would be to read up on setting up ssh keys:
https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html
https://help.github.com/articles/adding-a-new-ssh-key-to-your-github-account/

To know more about git commands:
https://www.atlassian.com/git/tutorials

Happy Coding!


Use composer when installing laravel. Here is the workflow that you should follow:

  • install laravel using composer
  • create your git repo from the above installation
  • start developing your application, commit, push, etc.
  • when you want to take the latest changes from laravel just use composer again: composer update, your vendor folder will be updated automatically. Be aware that the vendor folder is ignored by git, in this way you will have a clean commit history that will include only your application commits without the laravel ones.