# Push and Force Push with Verification

## Push Local Commits

```bash
[ "$AHEAD" -gt 0 ] && {
  echo "Pushing $AHEAD commit(s) to origin/$CURRENT..."
  git push origin $CURRENT

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

## Force Push After Rebase

```bash
# After successful rebase
if [ "$REBASED" = true ]; then
  echo "Rebase complete. Force pushing..."
  git push --force-with-lease origin $CURRENT

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