0

In the past I didn't use git and just created my web-projects local on my computer using XAMPP. By that I could create databases via phpmyadmin and simply save my other website files in the htdocs-folder (F:\xampp\htdocs). After that I just saw the result in my browser using localhost.

Now I want to version control my new web-project using git (I have learned the basics already). But the problem occurred that I don't know how to version control the whole website including my databases which are stored in a completely different folder (F:\xampp\mysql\data).

Do I have to version control the whole xampp folder? Or is it even possible to version control databases?

  • This question appears to be off-topic because it is about web development which is off-topic at Pro Webmasters. Web development questions may be asked at Stack Overflow but be sure to read their FAQ before posting to ensure your question meets their guidelines. – John Conde Jun 15 '19 at 11:45
  • Oh, I'm sorry. The next time I'll ask my question about web development there. But the funny thing about that is that I wanted to post this question at Stack Overflow but after reading their FAQ I decided to post this question here. – MeineHTMLCodes Jun 16 '19 at 12:07
0

To version control a whole project with its database, you could use a mysqldump to export the database in your htdocs directory before to commit it.

| improve this answer | |
  • Okay, thank you! And if I switch to an old commit, do I just have to import the .sql-file? – MeineHTMLCodes Jun 15 '19 at 9:25
  • Yep and you will recover the database at the same point as you backed up it. – gael Jun 15 '19 at 17:24
  • Oh thank you a lot! You saved me a lot of time :D – MeineHTMLCodes Jun 16 '19 at 12:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.