Should "content" folder be tracked on GIT repository?

Hi there, thanks for this great cms.
I’m about to start working on a new project and I’m planning to use Kirby.

Since my client will be adding the content directly on the server while I work o new features, is it correct to track the “content” folder on the GIT repository? Couldn’t that cause problems when deploying a new feature to the server, due to file conflicts/overwriting.

Do you have any suggestion / good practice about dev-workflow with Kirby & GIT on projects like this, where data entry and development process a running at the same time?

I hope you understand my concern.

Thanks in advance, regards Marcos,

I added the content folder to .gitignore but made sure that there’s a backup strategy for it on the live server.

I’d use a second repo for the content to keep that separate.

However, it should not be a problem to track the content folder on the Git repository, you could fetch the contents from the server into your local repo or push from the server to a remote as long as you work with Git on the server as well.

Edit: You can keep the content folder as a separate folder/repo outside of the rest. Check the docs. Then you don’t need to put it in the .gitignore and you dont need to work with a repo within a repo.

Thanks for your response,
But what about if I’m working with some sample data locally that could collide to a real data published by client. Kirby adds a prefix-number to each page for sorting, that is one of the first things that will produce a “conflict”, we could en up with to pages numbered ‘2’ as a prefix.

I understand that next time the user re-orders those pages (in panel) the prefix number will be fixed up by Kirby, but from GIT perspective that is a new file/folder and has to be add anded committed to repo. Even more that new file/folder is different to the one I pushed earlier then, so:

Example:

  • 2-client-page/ (uploaded to server directly by using the Kirby’s Panel)
  • 2-developer-page/ (uploaded to server because of a git push by developer)

Client sorts pages in Kirby’s Panel, set dev page to third:

  • 2-client-page/ (remains unchanged)
  • 3-developer-page/ (this would produce a file change from GIT perspective)

Locally in developer’s machine, the developer modifies its early created page:

  • 2-developer-page/ (after modification, developer commits & pushes it to the repo)

if I commit everything in server and push it to the repo, when pulling from developer’s machine we could end up with something similar to:

  • 2-client-page/
  • 2-developer-page/
  • 3-developer-page/

But only one “-developer-page” will be shown in Kirby’s Panel

Sorry for being insistent about this, may be I’m a bit confused. I’ve given Kirby a try before and I remember that was something nasty that happens during de development process if we tracked the “contents” folder.

Thanks again for your comments, regards.

Marcos

I generally use the following deployment strategy for my Kirby sites:

  • The content directory is a separate repository and added as a submodule to the main repo.
  • The main repo is deployed to the server when the developer pushes.
  • The content repo is deployed from the server when any file has been changed from the Panel, for example using this Kirby plugin.

This means that the content repo is never pushed by the dev and the main code repo is never pushed from the server (that makes no sense anyway). By using this deployment strategy, you have every change and every file in version control and you as the developer can clone the current state of the site at any time, but there can’t be any content conflict at any time (this is not a Kirby issue, but you would have this issue with any CMS, with a database or without).

7 Likes

Thanks, I’ll give it a try and see how it goes.

There is another discussion about this topic over here in case you need more input.

2 posts were merged into an existing topic: Git-commit-and-push-content