# Version Bumping After Release/Hotfix

## Determine Next Version

```bash
MAJOR=$(echo $VERSION | cut -d'.' -f1)
MINOR=$(echo $VERSION | cut -d'.' -f2)
PATCH=$(echo $VERSION | cut -d'.' -f3)

if [ "$BRANCH_TYPE" = "release" ]; then
  # Release: increment minor, reset patch
  NEXT_VERSION="$MAJOR.$((MINOR + 1)).0"
else
  # Hotfix: increment patch (patch was already bumped for the tag, bump again for next dev)
  NEXT_VERSION="$MAJOR.$MINOR.$((PATCH + 2))"
fi
```

## Update Configuration and Source Files

```bash
# Update config (using resolved config path)
sed -i "s/\"current\": \".*\"/\"current\": \"$NEXT_VERSION\"/" "$GF_CONFIG_FILE"

# Update source files
# csproj, package.json, etc.

git add -A
git commit -m "chore: bump version to $NEXT_VERSION for development"
git push origin $GF_DEVELOP_BRANCH

# CRITICAL: Verify push and update tracking refs
git fetch origin $GF_DEVELOP_BRANCH:refs/remotes/origin/$GF_DEVELOP_BRANCH --force --quiet
LOCAL_SHA=$(git rev-parse HEAD)
REMOTE_SHA=$(git rev-parse origin/$GF_DEVELOP_BRANCH)
if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
  echo "✅ Push verified - local/remote in sync"
else
  echo "⚠️ Push verification FAILED"
  echo "  Local:  $LOCAL_SHA"
  echo "  Remote: $REMOTE_SHA"
fi

echo "✅ Version bumped to $NEXT_VERSION"
```
