Skip to content

docs: Add version control and .gitignore best practices guide#8822

Open
vincent067 wants to merge 1 commit intomarimo-team:mainfrom
vincent067:docs/gitignore-best-practices-7708
Open

docs: Add version control and .gitignore best practices guide#8822
vincent067 wants to merge 1 commit intomarimo-team:mainfrom
vincent067:docs/gitignore-best-practices-7708

Conversation

@vincent067
Copy link
Copy Markdown

📝 Summary

This PR adds documentation on best practices for using .gitignore with Marimo, addressing the questions raised in #7708.

🔍 Changes

  • Documents the recommended pattern to ignore __marimo__/ directories
  • Explains what subdirectories are covered (cache/, session/, assets/)
  • Provides guidance on when to commit \_\_marimo\_\_ files (session snapshots, thumbnails for OpenGraph previews)
  • Includes selective .gitignore example for projects that need to version control session snapshots or assets

✅ Related Issue

Closes #7708

🙏 Thank You

Thanks to the marimo team for this amazing project! Happy to contribute to the documentation. Please let me know if any adjustments are needed.

Adds documentation on best practices for .gitignore when using Marimo.

- Documents the recommended pattern to ignore __marimo__/ directories
- Explains what subdirectories are covered (cache/, session/, assets/)
- Provides guidance on when to commit __marimo__ files (session snapshots,
  thumbnails for OpenGraph previews)
- Includes selective .gitignore example for projects that need to version
  control session snapshots or assets

Resolves marimo-team#7708
@vincent067 vincent067 requested a review from akshayka as a code owner March 22, 2026 19:12
Copilot AI review requested due to automatic review settings March 22, 2026 19:12
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 22, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 22, 2026 7:13pm

Request Review

@github-actions
Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


liwenjun-dev seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “.gitignore best practices” section to the Marimo docs to clarify which __marimo__/ artifacts should typically be ignored vs. committed, addressing confusion raised in #7708.

Changes:

  • Documents a recommended .gitignore pattern for ignoring __marimo__/ directories.
  • Explains what __marimo__/cache/, __marimo__/session/, and __marimo__/assets/ are used for.
  • Provides guidance and an example for selectively committing session snapshots and/or OpenGraph thumbnail assets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- `__marimo__/assets/` — generated thumbnail images for OpenGraph previews

!!! tip "When to commit `__marimo__` files"

Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The admonition has a blank line after !!! tip "When to commit ...". In MkDocs/Material admonitions, the content must follow immediately on the next indented line; the blank line can cause the tip body to render as a separate indented code block instead of tip content. Remove the blank line so the indented paragraph/list is part of the admonition.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +106 to +114
For these cases, you can use a more selective `.gitignore`:

```gitignore
# Ignore cache only (recommended for most projects)
**/__marimo__/cache/

# Allow session snapshots and assets to be committed when needed
!**/__marimo__/session/
!**/__marimo__/assets/
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “more selective .gitignore” example doesn’t match the explanation: !**/__marimo__/session/ and !**/__marimo__/assets/ are redundant here because those paths weren’t ignored by the preceding pattern (only cache/ is ignored). If the intent is “ignore all __marimo__ except session/assets”, note Git can’t re-include files inside an ignored directory unless the ignore rule ignores the directory contents (e.g., __marimo__/*) and then you unignore the desired subpaths. Please adjust the patterns and/or wording so the example actually enables committing session/assets while still ignoring the rest.

Suggested change
For these cases, you can use a more selective `.gitignore`:
```gitignore
# Ignore cache only (recommended for most projects)
**/__marimo__/cache/
# Allow session snapshots and assets to be committed when needed
!**/__marimo__/session/
!**/__marimo__/assets/
For these cases, you can use a more selective `.gitignore` that ignores
everything in `__marimo__` except session snapshots and assets:
```gitignore
# Ignore all marimo-managed files by default
**/__marimo__/*
# Allow session snapshots and assets to be committed when needed
!**/__marimo__/session/**
!**/__marimo__/assets/**

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had activity in 30 days. It will be closed in 14 days if no further activity occurs. If this PR is still relevant, please leave a comment or push new changes to keep it open. Thank you for your contribution!

@github-actions github-actions Bot added the stale label Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation on best practices for .gitignore when using Marimo

2 participants