|
| 1 | +# PR #2307 Merge Conflict Resolution Guide |
| 2 | + |
| 3 | +## Situation |
| 4 | + |
| 5 | +Your PR: https://github.com/opea-project/GenAIExamples/pull/2307 |
| 6 | +- **From:** `Cogniware-Inc:main` |
| 7 | +- **To:** `opea-project:main` |
| 8 | +- **Status:** Has conflicts that must be resolved |
| 9 | + |
| 10 | +## Step-by-Step Resolution |
| 11 | + |
| 12 | +### Step 1: Clone/Update Your Repository |
| 13 | + |
| 14 | +```bash |
| 15 | +# If you haven't cloned yet: |
| 16 | +git clone https://github.com/Cogniware-Inc/GenAIExamples.git |
| 17 | +cd GenAIExamples |
| 18 | + |
| 19 | +# OR if you already have it, update: |
| 20 | +cd /path/to/GenAIExamples |
| 21 | +git fetch origin |
| 22 | +git fetch upstream # If you have opea-project as upstream |
| 23 | +``` |
| 24 | + |
| 25 | +### Step 2: Set Up Remote Repositories |
| 26 | + |
| 27 | +```bash |
| 28 | +# Check current remotes |
| 29 | +git remote -v |
| 30 | + |
| 31 | +# If you don't have upstream, add it: |
| 32 | +git remote add upstream https://github.com/opea-project/GenAIExamples.git |
| 33 | + |
| 34 | +# Fetch from upstream |
| 35 | +git fetch upstream |
| 36 | +``` |
| 37 | + |
| 38 | +### Step 3: Checkout Your Branch |
| 39 | + |
| 40 | +```bash |
| 41 | +# Switch to your main branch (the one in the PR) |
| 42 | +git checkout main |
| 43 | + |
| 44 | +# Make sure you're on the right branch |
| 45 | +git branch |
| 46 | + |
| 47 | +# Pull latest from your fork |
| 48 | +git pull origin main |
| 49 | +``` |
| 50 | + |
| 51 | +### Step 4: Merge Upstream Main into Your Branch |
| 52 | + |
| 53 | +```bash |
| 54 | +# Merge opea-project's main into your branch |
| 55 | +git merge upstream/main |
| 56 | + |
| 57 | +# OR if upstream isn't set: |
| 58 | +git merge https://github.com/opea-project/GenAIExamples.git main |
| 59 | +``` |
| 60 | + |
| 61 | +### Step 5: Resolve Conflicts |
| 62 | + |
| 63 | +When conflicts appear, resolve them: |
| 64 | + |
| 65 | +```bash |
| 66 | +# Accept upstream version for EdgeCraftRAG (not your project) |
| 67 | +git checkout --theirs EdgeCraftRAG/ |
| 68 | +git add EdgeCraftRAG/ |
| 69 | + |
| 70 | +# Accept upstream version for .github files |
| 71 | +git checkout --theirs .github/code_spell_ignore.txt |
| 72 | +git add .github/code_spell_ignore.txt |
| 73 | + |
| 74 | +git checkout --theirs .github/workflows/pr-image-size.yml |
| 75 | +git add .github/workflows/pr-image-size.yml |
| 76 | + |
| 77 | +# Keep YOUR CogniwareIms changes |
| 78 | +git checkout --ours CogniwareIms/ |
| 79 | +git add CogniwareIms/ |
| 80 | + |
| 81 | +# Check what's left |
| 82 | +git status |
| 83 | +``` |
| 84 | + |
| 85 | +### Step 6: Complete the Merge |
| 86 | + |
| 87 | +```bash |
| 88 | +# Complete the merge |
| 89 | +git commit -s -m "Resolve merge conflicts: accept EdgeCraftRAG changes from upstream main" |
| 90 | +``` |
| 91 | + |
| 92 | +### Step 7: Push to Your Fork |
| 93 | + |
| 94 | +```bash |
| 95 | +# Push to your fork (Cogniware-Inc) |
| 96 | +git push origin main --force-with-lease |
| 97 | +``` |
| 98 | + |
| 99 | +The PR will automatically update once you push! |
| 100 | + |
| 101 | +## Alternative: Rebase Instead of Merge |
| 102 | + |
| 103 | +If you prefer a cleaner history: |
| 104 | + |
| 105 | +```bash |
| 106 | +# Rebase your branch onto upstream main |
| 107 | +git rebase upstream/main |
| 108 | + |
| 109 | +# Resolve conflicts as they appear (same commands as Step 5) |
| 110 | +# After each conflict resolution: |
| 111 | +git add . |
| 112 | +git rebase --continue |
| 113 | + |
| 114 | +# When done, force push |
| 115 | +git push origin main --force-with-lease |
| 116 | +``` |
| 117 | + |
| 118 | +## Complete Command Sequence (Copy & Paste) |
| 119 | + |
| 120 | +```bash |
| 121 | +# 1. Navigate to your repository |
| 122 | +cd /path/to/GenAIExamples |
| 123 | + |
| 124 | +# 2. Add upstream if not exists |
| 125 | +git remote add upstream https://github.com/opea-project/GenAIExamples.git 2>/dev/null || true |
| 126 | + |
| 127 | +# 3. Fetch latest |
| 128 | +git fetch upstream |
| 129 | +git fetch origin |
| 130 | + |
| 131 | +# 4. Checkout your branch |
| 132 | +git checkout main |
| 133 | +git pull origin main |
| 134 | + |
| 135 | +# 5. Merge upstream |
| 136 | +git merge upstream/main |
| 137 | + |
| 138 | +# 6. Resolve conflicts |
| 139 | +git checkout --theirs EdgeCraftRAG/ && git add EdgeCraftRAG/ |
| 140 | +git checkout --theirs .github/code_spell_ignore.txt && git add .github/code_spell_ignore.txt |
| 141 | +git checkout --theirs .github/workflows/pr-image-size.yml && git add .github/workflows/pr-image-size.yml |
| 142 | +git checkout --ours CogniwareIms/ && git add CogniwareIms/ |
| 143 | + |
| 144 | +# 7. Complete merge |
| 145 | +git commit -s -m "Resolve merge conflicts: accept EdgeCraftRAG changes from upstream main" |
| 146 | + |
| 147 | +# 8. Push |
| 148 | +git push origin main --force-with-lease |
| 149 | +``` |
| 150 | + |
| 151 | +## Verify Resolution |
| 152 | + |
| 153 | +After pushing: |
| 154 | + |
| 155 | +1. Go to your PR: https://github.com/opea-project/GenAIExamples/pull/2307 |
| 156 | +2. The status should change from "has conflicts" to "ready to merge" |
| 157 | +3. Check that all CI checks pass |
| 158 | + |
| 159 | +## Important Notes |
| 160 | + |
| 161 | +1. **Don't modify EdgeCraftRAG files** - The reviewer specifically said "Please do not change the code for the other OPEA examples" |
| 162 | + |
| 163 | +2. **Keep your CogniwareIms changes** - These are your contributions |
| 164 | + |
| 165 | +3. **Use `--force-with-lease`** - Safer than `--force`, prevents overwriting others' work |
| 166 | + |
| 167 | +4. **Sign your commits** - Use `-s` flag for DCO compliance |
| 168 | + |
| 169 | +## If You Get Stuck |
| 170 | + |
| 171 | +### Check Current Status |
| 172 | +```bash |
| 173 | +git status |
| 174 | +git log --oneline --graph -10 |
| 175 | +``` |
| 176 | + |
| 177 | +### See What's Different |
| 178 | +```bash |
| 179 | +git diff upstream/main...HEAD --name-only |
| 180 | +``` |
| 181 | + |
| 182 | +### Abort and Start Over |
| 183 | +```bash |
| 184 | +git merge --abort # or git rebase --abort |
| 185 | +``` |
| 186 | + |
| 187 | +## After Successful Merge |
| 188 | + |
| 189 | +Once conflicts are resolved and PR is merged: |
| 190 | +- Your CogniwareIms code will be in `opea-project/GenAIExamples/CogniwareIms/` |
| 191 | +- The PR will show as merged |
| 192 | +- You can delete your branch if desired |
| 193 | + |
| 194 | +--- |
| 195 | + |
| 196 | +**PR Link:** https://github.com/opea-project/GenAIExamples/pull/2307 |
| 197 | +**Status:** Ready for conflict resolution |
| 198 | +**Last Updated:** November 12, 2025 |
| 199 | + |
0 commit comments