Created
November 16, 2023 16:51
-
-
Save TonyWhitley/caf7d3275759690fd3d652e1d11f5cc9 to your computer and use it in GitHub Desktop.
Compare local file with the file in another git branch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
echo Compare local file with the file in another git branch | |
echo. | |
set /p branch=Branch to compare to? : | |
set /p file=File? (relative to repo root, use \ for paths) : | |
set file=.\%file: =% | |
rem %file: =% removes any spaces (aimed at trailing spaces) | |
if exist %file%.%branch% (echo temp file %file%.%branch% already exists | |
pause | |
goto :eof) | |
git show %branch%:./%file% > %file%.%branch% | |
**insert path to your favourite compare tool here** %file% %file%.%branch% | |
rem Tidy up | |
del %file%.%branch% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment