On Windows, I have a bat file that creates a git commit like so:
@echo off
echo.
echo -------------------------
cd C:\Repository\Other\notes-repo
git add --all
git commit -m "autoCommit"
git push
cd C:\Repository\Other
I call it from the command line like this:
note_repo_sync.bat >> log.txt 2>&1
When there are changes to the repo, then this gets added to the log file:
-------------------------
[main 013c443] autoCommit
1 file changed, 1 deletion(-)
To https://github.com/raelb/notes-repo.git
6bceead..013c443 main -> main
However, if I omit the 2>&1, i.e. print the stderr to console, then much more is shown:
C:\Repository\Other>notes_repo_sync.bat >> log.txt
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 290 bytes | 290.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/raelb/notes-repo.git
28a2bf3..691fb4f main -> main
Why are the extra lines (Enumerating objects etc..) not included in the log when I append 2>&1 to the command line?