问题
I often use the windows console called console2 and recently found PowerCmd, so I have been trying it out.
I create a Git repository and make and commit three changes. First the correct log in console2:
c:\code\junk>git log --pretty=oneline
015cfbec12208d7b719d523c92d0c46b726d42e6 third time lucky.
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8 Second commit
370e9cbb72feca9fb784843154f2171fefe2c656 initial commit
I get double the goodness using PowerCmd:
C:\code\junk>git log --pretty=oneline
[33m015cfbec12208d7b719d523c92d0c46b726d42e6[m third time lucky.
[33mc8a9ffeb4381cd515a62937a0a50b7dc5360dbb8[m Second commit
[33m370e9cbb72feca9fb784843154f2171fefe2c656[m initial commit
015cfbec12208d7b719d523c92d0c46b726d42e6 third time lucky.
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8 Second commit
370e9cbb72feca9fb784843154f2171fefe2c656 initial commit
Any body know whats up?
EDIT: Tried a suggestion --no-color and ....
C:\code\junk>git log --pretty=oneline --no-color
015cfbec12208d7b719d523c92d0c46b726d42e6 third time lucky.
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8 Second commit
370e9cbb72feca9fb784843154f2171fefe2c656 initial commit
015cfbec12208d7b719d523c92d0c46b726d42e6 third time lucky.
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8 Second commit
370e9cbb72feca9fb784843154f2171fefe2c656 initial commit
Too funny! I like PowerCmd, maybe just not for git.
回答1:
Those are ANSI escape sequence (for ANSI colors), and PowerCmd doesn't seem to support them (as mentioned in this thread)
You can try:
git log --no-color
That would allow you to check if there still is duplicate commits when you ask for no color.
I checked: the output is always doubled, even when I set TERM=msys
The only way I got it to behave is by redirecting stdout to a dummy text (not NUL, but an actual dummy file)
C:\Users\vonc\prog\git\git>git log -2 --no-color --oneline >dummy
f82887f Git 2.1-rc2
764c739 Merge branch 'mb/relnotes-2.1'
来源:https://stackoverflow.com/questions/25337683/why-does-powercmd-show-duplicate-git-commits