Refactor .gitignore for improved clarity and organization; remove unused git-pr-list image

This commit is contained in:
2026-04-19 18:18:01 +08:00
parent 6a540e4657
commit 1cae80ca80
4 changed files with 398 additions and 29 deletions

374
.gitignore vendored
View File

@@ -1,14 +1,374 @@
# claude # Tempary files
temp
sandbox.*
# Environments
.env
.envrc
.venv
.env.*
!.env.example
env/
venv/
ENV/
env.bak/
venv.bak/
# Claude
.claudian .claudian
# obsidian setting # Obsidian setting
.obsidian/* .obsidian/*
!.obsidian/snippets !.obsidian/snippets
!.obsidian/app.json !.obsidian/app.json
# tempary files # Blender
temp *.blend1
sandbox.*
# blender # Byte-compiled / optimized / DLL files
*.blend1 __pycache__/
*.py[codz]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py.cover
.hypothesis/
.pytest_cache/
cover/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
.pybuilder/
target/
# Jupyter Notebook
.ipynb_checkpoints
# IPython
profile_default/
ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
# Pipfile.lock
# UV
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# uv.lock
# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
# poetry.lock
# poetry.toml
# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
# pdm.lock
# pdm.toml
.pdm-python
.pdm-build/
# pixi
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
# pixi.lock
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
# in the .venv directory. It is recommended not to include this directory in version control.
.pixi
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
# Celery stuff
celerybeat-schedule
celerybeat.pid
# Redis
*.rdb
*.aof
*.pid
# RabbitMQ
mnesia/
rabbitmq/
rabbitmq-data/
# ActiveMQ
activemq-data/
# SageMath parsed files
*.sage.py
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
.dmypy.json
dmypy.json
# Pyre type checker
.pyre/
# pytype static type analyzer
.pytype/
# Cython debug symbols
cython_debug/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
# .idea/
# Abstra
# Abstra is an AI-powered process automation framework.
# Ignore directories containing user credentials, local state, and settings.
# Learn more at https://abstra.io/docs
.abstra/
# Visual Studio Code
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
# and can be added to the global gitignore or merged into this file. However, if you prefer,
# you could uncomment the following to ignore the entire vscode folder
# .vscode/
# Ruff stuff:
.ruff_cache/
# PyPI configuration file
.pypirc
# Marimo
marimo/_static/
marimo/_lsp/
__marimo__/
# Streamlit
.streamlit/secrets.toml
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Snowpack dependency directory (https://snowpack.dev/)
web_modules/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
out
# Nuxt.js build / generate output
.nuxt
dist
.output
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# vuepress v2.x temp and cache directory
.temp
.cache
# Sveltekit cache directory
.svelte-kit/
# vitepress build output
**/.vitepress/dist
# vitepress cache directory
**/.vitepress/cache
# Docusaurus cache and generated files
.docusaurus
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# Firebase cache directory
.firebase/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# pnpm
.pnpm-store
# yarn v3
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
# Vite files
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
.vite/

Binary file not shown.

View File

@@ -25,6 +25,10 @@ gitGraph
commit commit
checkout "个人分支-2" checkout "个人分支-2"
commit commit
checkout "个人分支-1"
commit
checkout "个人分支-2"
commit
checkout "主分支" checkout "主分支"
merge "个人分支-1" merge "个人分支-1"
checkout "主分支" checkout "主分支"
@@ -40,10 +44,6 @@ gitGraph
4. 通过「合并请求」,有监督地确认改动到主分支 4. 通过「合并请求」,有监督地确认改动到主分支
```mermaid ```mermaid
---
config:
theme: neutral
---
flowchart TD flowchart TD
changes(本地改动) changes(本地改动)
dev(个人分支 dev) dev(个人分支 dev)
@@ -58,6 +58,7 @@ flowchart TD
接下来,我将说明具体的操作(确保已安装 Git、VS Code,详见 [必装软件/工具](starter.md)) 接下来,我将说明具体的操作(确保已安装 Git、VS Code,详见 [必装软件/工具](starter.md))
### 仅在自己的「个人分支」工作 ### 仅在自己的「个人分支」工作
**1. 下载仓库(Repository)** **1. 下载仓库(Repository)**
@@ -87,6 +88,7 @@ flowchart TD
分支列表中有一些 `origin/*` 开头的分支,它们是属于远程仓库中的分支。但注意,这不代表它们存在于远程!想象一下,如果你处于断网状态,那么实际上这些 `origin/*` 分支也没有获得更新。而且它们的状态不会自动更新,除非你执行 `git fetch`、`git pull`、`git push`。 分支列表中有一些 `origin/*` 开头的分支,它们是属于远程仓库中的分支。但注意,这不代表它们存在于远程!想象一下,如果你处于断网状态,那么实际上这些 `origin/*` 分支也没有获得更新。而且它们的状态不会自动更新,除非你执行 `git fetch`、`git pull`、`git push`。
### 通过「提交」来确认改动到个人分支 ### 通过「提交」来确认改动到个人分支
**1. 有选择性地添加(Add)改动** **1. 有选择性地添加(Add)改动**
@@ -95,7 +97,7 @@ flowchart TD
![](assets/git-add.png) ![](assets/git-add.png)
> 或执行 `git add [file]` 或执行 `git add [file]`
**2. 提交(Commit)改动** **2. 提交(Commit)改动**
@@ -105,7 +107,7 @@ flowchart TD
![](assets/git-commit.png) ![](assets/git-commit.png)
> 或执行 `git commit -m [message]` 或执行 `git commit -m [message]`
**3. 推送(Push)到远程仓库的个人分支** **3. 推送(Push)到远程仓库的个人分支**
@@ -115,10 +117,11 @@ flowchart TD
![](assets/git-push.png) ![](assets/git-push.png)
> 或执行 `git push` 或执行 `git push`
这步是工作中最常用的:一边工作,一边适时地 Add > Commit > Push 这步是工作中最常用的:一边工作,一边适时地 Add > Commit > Push
### 更新其他人在「主分支」的改动 ### 更新其他人在「主分支」的改动
当你在自己分支工作时,其他人也在不断改动主分支`main`。有时需要对齐一下,拉取(Pull)并合并(Merge)来自主分支的更新到你自己的分支。 当你在自己分支工作时,其他人也在不断改动主分支`main`。有时需要对齐一下,拉取(Pull)并合并(Merge)来自主分支的更新到你自己的分支。
@@ -127,14 +130,17 @@ flowchart TD
![](assets/git-pull-origin-main.png) ![](assets/git-pull-origin-main.png)
> 或执行 `git pull origin main` 或执行 `git pull origin main`
如果冲突,会进入`([branch-name]|MERGING)` 状态,详见 [解决冲突](#解决合并冲突) 如果冲突,会进入`([branch-name]|MERGING)` 状态,详见 [解决冲突](#解决合并冲突)
### 通过「合并请求」来确认改动到主分支 ### 通过「合并请求」来确认改动到主分支
合并请求(Pull Request,PR)就是个人分支合并入主分支的申请。 合并请求(Pull Request,PR)就是个人分支合并入主分支的申请。
> ⚠️ 在提 PR 前,**一定**要在本地执行 [同步「主分支」的改动](#同步「主分支」的改动)(且同步给了远程仓库的个人分支)
浏览器访问仓库主页,切换到个人分支,点击 New Pull Request 按钮(3) 浏览器访问仓库主页,切换到个人分支,点击 New Pull Request 按钮(3)
![](assets/git-checkout-feat.png) ![](assets/git-checkout-feat.png)
@@ -145,14 +151,11 @@ flowchart TD
PR 会加入队列,等待审核通过。通过后就会合并到主分支啦。 PR 会加入队列,等待审核通过。通过后就会合并到主分支啦。
![](assets/git-pr-list.png)
⚠️ 在提 PR 前,**一定**要在本地执行[同步「主分支」的改动](#同步「主分支」的改动)(且同步给了远程仓库的个人分支)
> 在提 PR 后,如果你又更新了你的分支,不必再次提 PR > 在提 PR 后,如果你又更新了你的分支,不必再次提 PR
## 最佳实践 ## 最佳实践
### 多设备编辑同一分支 ### 多设备编辑同一分支
首先不推荐这样做,但是为了一个设备,新加分支也很没必要。但如果由一个人操作这些设备,比如个人的 macbook、iphone 共同编辑,只要严格遵守下面两条: 首先不推荐这样做,但是为了一个设备,新加分支也很没必要。但如果由一个人操作这些设备,比如个人的 macbook、iphone 共同编辑,只要严格遵守下面两条:
@@ -161,19 +164,20 @@ PR 会加入队列,等待审核通过。通过后就会合并到主分支啦
> 为什么不用 icloud?因为这样可以实现部分同步,能适应复杂的文件夹,打开也更快。 > 为什么不用 icloud?因为这样可以实现部分同步,能适应复杂的文件夹,打开也更快。
### 解决合并冲突 ### 解决合并冲突
解决完冲突后,继续 解决完冲突后,继续
> 或执行 `git merge --continue` 或执行 `git merge --continue`
或者退出,不解决 或者退出,不解决
> 或执行 `git merge --abort` 或执行 `git merge --abort`
> 大文件处理完合并后,变成指针文件 大文件处理完合并后,变成指针文件
> 执行 `git lfs pull` 拉回原始文件 执行 `git lfs pull` 拉回原始文件
### 虽然文件 ignore 了,但因为曾经加过,所以还在被追踪 ### 虽然文件 ignore 了,但因为曾经加过,所以还在被追踪
@@ -184,4 +188,4 @@ PR 会加入队列,等待审核通过。通过后就会合并到主分支啦
### 个人分支的提交记录,本地和远程仓库不一致 ### 个人分支的提交记录,本地和远程仓库不一致
`git push --force-with-lease` 执行 `git push --force-with-lease`

View File

@@ -2,14 +2,22 @@
偶魔的采用 Omoospace 方案管理项目文件夹。在它基础上设置了如下结构: 偶魔的采用 Omoospace 方案管理项目文件夹。在它基础上设置了如下结构:
```bash
[root-dir]
├── .obsidian # obsidian 配置文件
├── contents/ # 被引用的资源、成品
├── notes/ # 记录文档
├── references/ # 资料文件
├── subspaces/ # 工程文件、制作文件
├── OMOOSPACE.md # Omoospace
└── README.md # 自述文档
```
存放和项目相关的,项目专属的文件,例如 存放和项目相关的,项目专属的文件,例如
- 项目专属的配置文件 - 项目专属的配置文件
- 创作过程文件 - 创作过程文件
私密的、涉及安全的,绝不能放入,例如 私密的、涉及安全的,绝不能放入,例如
- 密钥、环境配置 - 密钥、环境配置
- 合同、报价单 - 合同、报价单