Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up Laravel project with Git

Tags:

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!

like image 350
salxander Avatar asked Mar 08 '14 21:03

salxander


People also ask

Can GitHub host Laravel project?

STEP 1: Use Git First, push your locally created laravel app to a remote repo. PS: Don't initiate the repo with README. Just to avoid running into some novice errors. This should send your local Laravel App to GitHub.


2 Answers

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 
like image 124
Antonio Carlos Ribeiro Avatar answered Oct 04 '22 01:10

Antonio Carlos Ribeiro


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!

like image 36
joemalski Avatar answered Oct 04 '22 00:10

joemalski