# WordPress Plugin Development: Git + SVN Workflow

## Current Project Structure ✅

```
/integrate-elementor-form-with-mailster/
├── .svn/                     # SVN working copy (entire project)
├── trunk/                    # Active development
│   ├── .git/                # Git repository (version control)
│   ├── .gitignore           # Git ignore rules
│   ├── plugin files...
│   └── readme.txt
├── tags/                     # Released versions (no .git folders!)
│   ├── 1.6.0/
│   ├── 1.5.1/
│   └── ...
└── assets/                   # Plugin assets for WordPress.org
```

## Development Workflow

### 1. Daily Development (in `trunk/`)

```bash
cd trunk/

# Git operations for version control
git add .
git commit -m "Feature: Add new functionality"
git push origin main

# When ready to test locally
# Your changes are in trunk/ - test thoroughly
```

### 2. Releasing a New Version

```bash
# 1. Ensure trunk/ is ready
cd trunk/
git commit -am "Version 1.6.1 ready for release"
git tag v1.6.1
git push origin main --tags

# 2. Create SVN tag (from project root)
cd ..
svn copy trunk/ tags/1.6.1/
svn add tags/1.6.1/

# 3. Update stable tag in trunk/readme.txt
# Edit: Stable tag: 1.6.1

# 4. Commit to SVN
svn commit -m "Release version 1.6.1"
```

### 3. Important Rules

#### ✅ DO:
- Keep Git repository ONLY in `trunk/`
- Use Git for daily development and version control
- Use SVN for WordPress.org releases
- Always test in `trunk/` before creating tags
- Remove any `.git` folders from `tags/` directories

#### ❌ DON'T:
- Put Git repositories in `tags/` folders
- Commit `.git` folders to SVN
- Edit files directly in `tags/` (use `trunk/` then copy)

## Benefits of This Setup

1. **Git for Development**: Full version control, branching, pull requests
2. **SVN for Distribution**: Required by WordPress.org
3. **Clean Separation**: Tags are clean snapshots without Git metadata
4. **Backup**: Both Git (remote) and SVN (WordPress.org) serve as backups

## Quick Commands

### Check what's ready for SVN commit:
```bash
svn status
```

### See Git status in trunk:
```bash
cd trunk/
git status
```

### Clean any accidentally created .git folders in tags:
```bash
find tags/ -name ".git" -type d -exec rm -rf {} +
```

### Create new release:
```bash
# In trunk/: develop and commit to Git
# From root: copy to SVN tag and commit
svn copy trunk/ tags/X.X.X/
svn add tags/X.X.X/
svn commit -m "Release X.X.X"
```

## Files to Keep in Git (trunk/) Only

- Development tools config (`.vscode/`, `.idea/`)
- Build processes (`package.json`, `webpack.config.js`)
- Development documentation
- Git-specific files (`.gitignore`, `.github/`)

## Files for Both Git and SVN

- Plugin source code
- `readme.txt`
- `LICENSE`
- End-user documentation