This repository uses a selective tracking system to manage a large game project with an 8GB+ Assets folder. Only edited files are committed to GitHub, keeping the repository lightweight while sharing code changes with the team.
/home/localuser/Documents/Projects/RPG/
├── Assets/ # Main project folder (mostly ignored by git)
│ ├── _git/ # ✓ TRACKED: Only edited files go here
│ ├── Scenes/ # ✗ Not tracked (too large)
│ ├── Dragonsan/ # ✗ Not tracked (too large)
│ ├── Atavism demo/ # ✗ Not tracked (too large)
│ └── Resources/ # ✗ Not tracked (too large)
├── .gitignore # Whitelist rules for _git folder only
├── .git/hooks/pre-commit # Auto-copies files on commit
└── README.md # This file
When you commit, a pre-commit hook automatically:
- Detects which files you've staged for commit
- Moves them to
Assets/_git/preserving folder structure - Backs up the original files as
.bak(so there's no duplication) - Stages the moved files automatically
- Commits everything in one shot
Result: You edit files normally, commit, and the hook moves them to _git/ while keeping a backup of the original as .bak.
Edit your files anywhere in the Assets/ folder as usual:
# Example: Edit a script in its normal location
vim Assets/Atavism\ demo/OtherPackages/SFBayStudios/SFB\ Demo\ Scripts/SFB_AudioManager.csgit add Assets/Atavism\ demo/OtherPackages/SFBayStudios/SFB\ Demo\ Scripts/SFB_AudioManager.csgit commit -m "Fixed audio manager Atavism namespace issue"What happens automatically:
- ✓ File moved to:
Assets/_git/Atavism demo/OtherPackages/SFBayStudios/SFB Demo Scripts/SFB_AudioManager.cs - ✓ Original backed up as:
Assets/Atavism demo/OtherPackages/SFBayStudios/SFB Demo Scripts/SFB_AudioManager.cs.bak - ✓ Folder structure preserved
- ✓
.metafile also tracked (if it exists) - ✓ Moved file staged automatically
- ✓ Commit created with all files
git push origin master- Edit files in their normal location (e.g.,
Assets/Scripts/MyScript.cs) - Commit from their normal location - the hook handles moving
- Keep the full path when files end up in
_git/(this is automatic) - Commit message should describe the change, not the file location
- Delete
.bakbackup files if you don't need them (they're just backups)
- Don't manually move files to
_git/- the hook does this - Don't edit files in the
_git/folder directly - edit the originals in Assets/ - Don't commit the
.bakfiles - they're automatically ignored by git - Don't forget to add/commit your changes - just do
git add Assets/yourfile.csandgit commit
Here's how files are moved and backed up:
| Original Location | After Commit (moved to _git/) | Backup Created |
|---|---|---|
Assets/Scripts/Player.cs |
Assets/_git/Scripts/Player.cs |
Assets/Scripts/Player.cs.bak |
Assets/Scenes/MainScene.meta |
Assets/_git/Scenes/MainScene.meta |
Assets/Scenes/MainScene.meta.bak |
Assets/Atavism demo/OtherPackages/SFBayStudios/SFB Demo Scripts/SFB_AudioManager.cs |
Assets/_git/Atavism demo/OtherPackages/SFBayStudios/SFB Demo Scripts/SFB_AudioManager.cs |
Assets/Atavism demo/OtherPackages/SFBayStudios/SFB Demo Scripts/SFB_AudioManager.cs.bak |
The full path is ALWAYS preserved - this makes it crystal clear what was changed. The .bak files are backups (ignored by git) and can be deleted if you don't need them.
git statusgit diff Assets/YourFile.csgit add Assets/YourFile.cs
git commit -m "Your clear commit message here"git push origin mastergit log --onelinegit pull origin masterWhen team members clone this repo for the first time:
# Clone the repo
git clone https://github.com/RunlevelSystems/mystical-islands.git
cd mystical-islands
# They will only get:
# - The _git folder with edited scripts
# - The .gitignore
# - This README
# To get the full Assets folder:
# 1. Copy the large Assets folder from our network/cloud storage
# 2. Merge the edits from _git/ back into Assets/ as needed- Check if the hook is executable:
chmod +x .git/hooks/pre-commit - Verify git is tracking your file correctly:
git status
- That's normal! The hook creates a
.bakbackup so you have a fallback .bakfiles are automatically ignored by git (not tracked)- Delete them manually if you don't need them:
rm Assets/myfile.cs.bak
- Edit the
.bakfile to get the content back - Copy it to the
_git/location - Delete the
.bakwhen done
.bakfiles are kept in the original location- Copy it back to the original name if needed:
cp Assets/file.cs.bak Assets/file.cs
- Make sure you used
git addandgit commit - The hook only runs on
git commit, not ongit add
# Manual one-time copy of everything (if needed)
cp -r Assets/* Assets/_git/
# Then rename originals to .bak to avoid duplication
find Assets -type f -not -path "Assets/_git/*" -exec mv {} {}.bak \;
git add Assets/_git/
git commit -m "Synced full assets to tracking folder"- GitHub Repo: https://github.com/RunlevelSystems/mystical-islands.git
- Tracked Files: Only files in
Assets/_git/ - Ignored Size: ~8GB of assets (not uploaded)
- Repository Size: Only code and edited files (~few MB)
# Stage a file
git add Assets/yourfile.cs
# Commit (hook auto-copies to _git/)
git commit -m "Your message"
# Push to GitHub
git push
# Pull latest from team
git pull
# Check what's staged
git status
# Undo unstaged changes
git checkout -- Assets/yourfile.cs
# Undo last commit (keep changes)
git reset --soft HEAD~1If you have questions about the workflow:
- Check
git logto see how previous commits worked - Look at the folder structure in
Assets/_git/to see what's tracked - Ask the team lead
Happy developing! 🎮