How to Fork and Keep Updated
InstaCRUD is designed to be forked and customized while still receiving upstream updates. This guide explains how to maintain your fork and merge new features from the main repository.
Why Fork?
Forking InstaCRUD gives you:
- Full ownership — Your code, your rules
- Customization freedom — Modify anything without restrictions
- Update pathway — Pull improvements from upstream
- Contribution opportunity — Submit fixes back to the community
Initial Setup
Step 1: Fork the Repository
- Go to InstaCRUD on GitHub
- Click Fork (top right)
- Select your account/organization
- Wait for fork to complete
Step 2: Clone Your Fork
git clone https://github.com/YOUR_USERNAME/instacrud-proto.git
cd instacrud-proto
Step 3: Add Upstream Remote
Link your fork to the original repository:
git remote add upstream https://github.com/esng-one/instacrud-proto.git
git remote -v
You should see:
origin https://github.com/YOUR_USERNAME/instacrud-proto.git (fetch)
origin https://github.com/YOUR_USERNAME/instacrud-proto.git (push)
upstream https://github.com/esng-one/instacrud-proto.git (fetch)
upstream https://github.com/esng-one/instacrud-proto.git (push)
Keeping Updated
Method 1: GitHub Sync Button (Easiest)
- Go to your fork on GitHub
- Click Sync fork button
- Click Update branch
This works when there are no conflicts.
Method 2: Command Line
For more control or when conflicts exist:
# Fetch upstream changes
git fetch upstream
# Switch to main branch
git checkout main
# Merge upstream changes
git merge upstream/main
# Push to your fork
git push origin main
Handling Merge Conflicts
When conflicts occur:
- Git marks conflicting files
- Open each file and resolve conflicts
- Look for conflict markers:
<<<<<<< HEAD
Your changes
=======
Upstream changes
>>>>>>> upstream/main - Edit to keep the correct code
- Stage and commit:
git add .
git commit -m "Merge upstream/main, resolve conflicts"
git push origin main
Using Claude Code for Conflict Resolution
Claude Code can help resolve merge conflicts:
- Run the merge command
- When conflicts occur, ask Claude Code:
Help me resolve merge conflicts in backend/instacrud/api/organization_api.py - Claude Code will analyze both versions and suggest resolutions
- Or simply ask Claude to merge changes from upstream and resolve all conflicts
Best Practices for Minimal Conflicts
-
Keep the folder structure unchanged where reasonable and Git will handle most merges automatically while conflicts are easily resolved by Claude Code. This is especially valuable on the frontend — maintain the structure and you can pull not only InstaCRUD updates but TailAdmin updates as well.
-
If you have important improvements, consider creating a Pull Request to include them in InstaCRUD so everyone benefits.
Syncing Feature Branches
If you work on feature branches:
# Update main first
git checkout main
git fetch upstream
git merge upstream/main
# Rebase your feature branch
git checkout my-feature
git rebase main
# Or merge main into feature
git merge main
Upstream Contribution
Found a bug or made an improvement? Contribute back:
Step 1: Create Feature Branch
git checkout main
git checkout -b fix/my-bugfix
Step 2: Make Changes
Implement your fix or feature.
Step 3: Push to Your Fork
git push origin fix/my-bugfix
Step 4: Create Pull Request
- Go to your fork on GitHub
- Click Compare & pull request
- Select
esng-one/instacrud-protoas base - Describe your changes
- Submit the PR
Versioning Your Fork
Consider tagging releases in your fork:
# Tag a release
git tag -a v1.0.0 -m "Initial customized release"
git push origin v1.0.0
# Tag after major customizations
git tag -a v1.1.0 -m "Added custom reporting module"
git push origin v1.1.0
This helps track which upstream version your customizations are based on.
Troubleshooting
"Divergent Branches" Error
# If branches have diverged significantly
git pull upstream main --rebase
# Or force sync (loses local changes on main)
git fetch upstream
git reset --hard upstream/main
git push origin main --force
Large Merge Conflicts
For major version updates with many conflicts:
- Create a backup branch:
git checkout -b backup-before-merge - List all conflicts:
git diff --name-only --diff-filter=U - Resolve one file at a time
- Test thoroughly after each major resolution
Accidentally Committed to Main
# Move commits to a feature branch
git checkout -b my-feature
git checkout main
git reset --hard upstream/main
Summary
Maintaining a fork effectively:
- Set up upstream remote after forking
- Sync regularly to avoid large merge conflicts
- Extend rather than modify core files
- Use separate directories for custom code
- Contribute back valuable improvements
- Tag releases to track customization versions