Skip to content

Instantly share code, notes, and snippets.

@justnom
Last active August 29, 2015 13:55
Show Gist options
  • Save justnom/8691472 to your computer and use it in GitHub Desktop.
Save justnom/8691472 to your computer and use it in GitHub Desktop.
Sync with a fork - this assumes no merge conflicts.
@echo off
set OLDDIR=%CD%
cd /d %TEMP%
set /p repo=Enter the forked Git repo:
set /p upstream=Enter the upstream Git repo:
:: Clone the forked repo
if exist "forked_repo" del /q /s /f "forked_repo"
git clone %repo% "forked_repo"
cd "forked_repo"
:: Add the upstream remote
git remote add upstream %upstream%
:: Merge the upstream repo and push it up to the origin
git fetch upstream
git checkout master
git merge upstream/master
git push
cd /d %OLDDIR%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment