Export All Modified and New Added Files in Git on Windows part 2

2019-08-10


We have already introduced how to use commamd line to Export All Modified and New Added Files in Git on Windows

The original command is:

for /f "usebackq tokens=*" %A in (`git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT HEAD~1 HEAD`) do echo FA|xcopy "%~fA" "C:\git_changed_files\%A"

But the above command has a problem: when there are a lot of files being modified, we will see a lot of information on the screen. This information makes us wait for a long time sometimes.

In fact, if there are no errors, we do not need to see this information.

How can we not display those information? We can use the echo off of DOS:


@echo off

for /f "usebackq tokens=*" %A in (`git diff-tree -r --no-commit-id --name-only --diff-filter=ACMRT HEAD~1 HEAD`) do echo FA|xcopy "%~fA" "D:\temp\gitchangedfiles\%A" > nul 2>&1

@echo on