Git - Remote and Upstream Management
Created by: Lester Caine, Last modification: 10 May 2026
Setup remotes
# Check current remotes git remote -v # Add upstream (original repo your fork came from) git remote add upstream https://github.com/ADOdb/ADOdb.git # Add SSH alternative (no password prompts) git remote add upstream git@github.com:ADOdb/ADOdb.git # Change existing remote URL git remote set-url origin git@github.com:lsces/adodb.git # Remove a remote git remote remove upstream
Syncing with upstream
# Fetch upstream changes (no merge) git fetch upstream # Fetch upstream including tags git fetch upstream --tags # Merge upstream into current branch git merge upstream/master # Or rebase on upstream (cleaner history) git rebase upstream/master
Tags
# List local tags git tag -l # List tags sorted by version git tag -l | sort -V # Fetch tags from upstream (not fetched by default!) git fetch upstream --tags # Fetch tags from origin git fetch origin --tags # Push single tag to fork git push origin v5.22.11 # Push all tags to fork git push origin --tags # Force push tags (if upstream changed a tag) git fetch upstream --tags --force git push origin --tags --force
Check what's different
# Commits in upstream not in your fork git log --oneline HEAD..upstream/master # Commits in your fork not in upstream (your changes) git log --oneline upstream/master..HEAD # Files changed between versions git diff v5.22.10..v5.22.11 # Files changed in specific driver git diff v5.22.10..v5.22.11 -- drivers/adodb-firebird.inc.php
Keeping fork in sync workflow
# 1. Fetch upstream git fetch upstream --tags # 2. Check what's new git log --oneline HEAD..upstream/master # 3. Merge or rebase git merge upstream/master # or git rebase upstream/master # 4. Push to your fork git push origin master git push origin --tags
Switch remote from HTTPS to SSH
# Check current git remote get-url origin # Switch to SSH (no more password prompts) git remote set-url origin git@github.com:lsces/adodb.git # Verify git remote -v
Troubleshooting
Tags not showing in VSCode/fork:
git fetch upstream --tags git push origin --tags
"Already up to date" but tags missing:
# Tags sync separately from commits! git fetch --tags # fetch from all remotes git push origin --tags
Fork behind upstream:
git fetch upstream git log --oneline HEAD..upstream/master # see what's missing git merge upstream/master git push origin master
Diverged from upstream (have local changes):
# Rebase keeps your changes on top of upstream git rebase upstream/master # Fix any conflicts, then git push origin master --force-with-lease
Developed with [Claude AI](https://claude.ai) assistance - Anthropic - May 2026
