mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-10 17:26:17 +00:00
- Changed working directory in Dockerfile from /usr/src/microsoft-rewards-script to /app - Updated Docker container name and service name from microsoft-rewards-script to microsoft-rewards-bot - Modified LICENSE, NOTICE, README.md, and other documentation files to reflect new project ownership - Updated package.json and package-lock.json to change project name and repository links - Adjusted entrypoint script and Docker Compose configurations for new paths - Updated security and login handling in source code to reflect new documentation URLs - Changed logo asset to reflect new branding
3.8 KiB
3.8 KiB
Git Conflict Resolution Guide
Problem: "Pulling is not possible because you have unmerged files"
This error occurs when Git has conflicting changes between your local repository and the remote repository.
Quick Fix (Recommended)
Option 1: Keep Remote Changes (Safest for updates)
# Abort any ongoing operations
git merge --abort
git rebase --abort
# Reset to remote version (discards local changes)
git fetch --all
git reset --hard origin/main
# Reinstall and rebuild
npm ci
npm run build
Option 2: Keep Local Changes
# Save your changes
git stash push -m "My local changes"
# Get remote changes
git fetch --all
git reset --hard origin/main
# Reapply your changes (may cause conflicts again)
git stash pop
Automatic Conflict Prevention
The update script (setup/update/update.mjs) now automatically:
- Detects conflicts before attempting updates
- Aborts failed merge/rebase operations
- Preserves your stashed changes
- Reports exactly what went wrong
Update Script Features
- ✅ Pre-flight conflict detection
- ✅ Automatic abort of failed operations
- ✅ Smart backup of config.jsonc and accounts.json
- ✅ User-configurable auto-update preferences
- ✅ Detailed error reporting with recovery instructions
Config Options
In config.jsonc, set these to control what gets auto-updated:
{
"update": {
"autoUpdateConfig": false, // Keep your local config.jsonc
"autoUpdateAccounts": false, // Keep your local accounts.json
"git": true, // Enable Git updates
"docker": false // Enable Docker updates
}
}
Manual Conflict Resolution
If you need to manually resolve conflicts:
1. Check Status
git status
2. View Conflicted Files
git ls-files -u
3. For Each Conflicted File
Option A: Keep Remote Version
git checkout --theirs <file>
git add <file>
Option B: Keep Local Version
git checkout --ours <file>
git add <file>
Option C: Manual Edit
- Open the file
- Look for
<<<<<<<,=======,>>>>>>>markers - Edit to keep what you want
- Remove the markers
- Save the file
git add <file>
4. Complete the Merge
git commit -m "Resolved conflicts"
Prevention Tips
- Don't edit code files directly - they're meant to be updated from Git
- Only customize
config.jsoncandaccounts.json - Use the auto-update feature with proper config flags
- Commit your config changes if you want version control
- Use branches for custom modifications
Troubleshooting
"detached HEAD state"
git checkout main
git pull
"Your branch has diverged"
git fetch origin
git reset --hard origin/main
"Permission denied" or file locks
On Windows:
# Close all Node/VS Code instances
taskkill /F /IM node.exe
git clean -fd
git reset --hard origin/main
On Linux/macOS:
sudo chown -R $USER:$USER .git
git clean -fd
git reset --hard origin/main
Emergency Recovery
If everything is broken:
# Backup your config and accounts
cp src/config.jsonc ~/backup-config.jsonc
cp src/accounts.json ~/backup-accounts.json
# Nuclear option: fresh clone
cd ..
rm -rf Microsoft-Rewards-Bot
git clone https://github.com/Obsidian-wtf/Microsoft-Rewards-Bot.git
cd Microsoft-Rewards-Bot
# Restore your files
cp ~/backup-config.jsonc src/config.jsonc
cp ~/backup-accounts.json src/accounts.json
# Reinstall
npm ci
npm run build
Support
If conflicts persist:
- Check GitHub Issues
- Create a new issue with the output of
git status - Include your update configuration settings
- Mention your OS and Git version
Remember: The safest approach is to let Git updates manage code files, and only customize config and accounts files.