简体   繁体   中英

How to setup Laravel project with git (hosted in XAMPP, by multiple computers)

I am currently working on a local Laravel project, and I am using XAMPP .

Basically, I want to transfer my project between 2 computers daily, and I think that Github will help.

But the question I have is that which folders should I include for my git upload ( mysql , htdocs and thats it?).

I have 1 Laravel project in htdocs , and 1 database in mysql folder that gets updated frequently. I have set my project up with composer .

As ADyson mentioned in comments:

You should source-control everything you need. Take a look at your information. If you need it on both computers, then source-control it in your git. If it would be a problem if you lost that data, then source-control it and push it to an external resource like github (as a backup if nothing else). If you need to know the history of changes to that item, then source-control it. We can't make those decisions for you, we don't know anything really about the structure of your application or what other files you might have apart from what you've mentioned.

But in addition, you should know that in most (if not every) Git repository, a .gitignore file exists which is a default-template, and tells Git what should be excluded and what included (tracked).

Just get started with developing, and continue without changing .gitignore , at least until you specifically need something to be excluded/included.

But I am worried that you mentioned mysql directory . Tracking htdocs directory should be fine, but the mysql directory is mostly binary and although Git -repository can include binary, it should be avoided, and you should instead learn Laravel seeder and migration scripts.

Example Laravel .gitignore file:

In case you don't have the default.

# node.js
#
/node_modules/
npm-debug.log
yarn-error.log

/public/hot/
/public/storage/
/storage/*.key
/vendor/
.env
.env.backup
.phpunit.result.cache
Homestead.json
Homestead.yaml

####################################################
# At Last Standard-Filters
#

# Mac OS X clutter
#
*.DS_Store

# Windows clutter
Thumbs.db

# Intellij IDEs
.idea/
# Intellij IDEA (see https://intellij-support.jetbrains.com/entries/23393067)
.idea/workspace.xml
.idea/tasks.xml
# Android/IntelliJ IDEs
#
build/
.build/
.gradle/
.nb-gradle/
*.iml
local.properties
#gradle.properties

# Visual Studio Code
#
.vscode/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM