Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Store git fetch output in a txt file

Tags:

git

batch-file

I want to store the output of this command in a text file and this was my attempt:

git fetch -v --dry-run >test.txt

All what happens is it continues to write to the console and creates an empty txt file. On a high level, I am writing a batch file to determine if there are changes to update my local copy of the repository.

like image 335
user2296207 Avatar asked Dec 11 '22 13:12

user2296207


1 Answers

The output is written to stderr, not to stdout. So you have to add 2>&1 to the command line.

like image 87
Slaven Rezic Avatar answered Dec 31 '22 12:12

Slaven Rezic