Skip to content

Instantly share code, notes, and snippets.

@andry81
Last active March 23, 2026 14:41
Show Gist options
  • Select an option

  • Save andry81/e6b0f80a106e8820b03ede3c2edc0109 to your computer and use it in GitHub Desktop.

Select an option

Save andry81/e6b0f80a106e8820b03ede3c2edc0109 to your computer and use it in GitHub Desktop.
Git fork tags synchronization
  • git_sync_fork_tags.md
  • 2025.03.23
  1. DESCRIPTION
  2. CODE

  1. DESCRIPTION

Script to synchronize a forked repository tags with the upstream.


  1. CODE

Clone, for example, the fork repository https://myhub.com/user/my-fork-1 into myforks/my-fork-1 directory.

Create script in the myforks directory.

sync-tags--my-fork-1.bat:

@echo off

setlocal ENABLEDELAYEDEXPANSION

set "SCRIPTNAME=%~n0"

pushd "%~dp0!SCRIPTNAME:sync-tags--=!" && (
  call :CMD git remote add upstream https://myhub.com/user/my-fork-1
  call :CMD git fetch --tags --force upstream
  call :CMD git push --tags --force origin
  popd
)

exit /b

:CMD
echo ^>%*
%*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment