24

I'm pretty new to using git, and I wanted to figure out the "best practice" way of setting up a laravel project in my own repo and still be able to fetch updates from the main project (https://github.com/laravel/laravel.git) and merge them with my project?

Could anybody walk me through this with step by step commands?

I would really appreciate it.

Thanks!

2
  • You can 'fork' the laravel repository Commented Mar 8, 2014 at 21:56
  • Will I be able to fetch updates from the original repo and merge with mine this way? Commented Mar 8, 2014 at 22:04

4 Answers 4

36

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 -A
git 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
Sign up to request clarification or add additional context in comments.

2 Comments

I'm creating a project with this command: composer create-project apiato/apiato apiato --prefer-dist Problem is that this doesn't have git repo there is no origin to be renamed?
Yes, it feels like a step may be missing here, plus the two repositories are quite different (the composer pulled, and the laravel/framework repositories).
7

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!

Comments

5

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.

Comments

1

You may also try using Fork, Sourcetree or GitKraken if you want to have some user interface when doing versioning control with your project. You will not use anymore git commands if you have it in your machine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.