为什么PowerCmd显示重复的git commit? [英] Why does PowerCmd show duplicate git commits?

查看:72
本文介绍了为什么PowerCmd显示重复的git commit?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用名为 console2 的Windows控制台,并且最近发现了 PowerCmd ,所以我一直在尝试。



我创建了一个Git存储库,进行并提交了三个更改。首先在 console2 中输入正确的日志:

  c:\code\junk> git日志- -pretty = oneline 
015cfbec12208d7b719d523c92d0c46b726d42e6第三次幸运。
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8第二次提交
370e9cbb72feca9fb784843154f2171fefe2c656最初提交

我使用 PowerCmd

  C:\code\junk> git log --pretty = oneline 
[33m015cfbec12208d7b719d523c92d0c46b726d42e6 [m第三次幸运。
[33mc8a9ffeb4381cd515a62937a0a50b7dc5360dbb8 [m第二次提交
[33m370e9cbb72feca9fb784843154f2171fefe2c656 [m初始提交
015cfbec12208d7b719d523c92d0c46b726d42e6
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8第二次提交
370e9cbb72feca9fb784843154f2171fefe2c656最初提交

任何人都知道这是什么吗? / p>

编辑:
尝试了一个建议-无色和....

  C: junk> git log --pretty = oneline --no-color 
015cfbec12208d7b719d523c92d0c46b726d42e6第三次幸运。
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8第二次提交
370e9cbb72feca9fb784843154f2171fefe2c656首次提交
015cfbec12208d7b719d523c92d0c46b726d42e6第三次幸运。
c8a9ffeb4381cd515a62937a0a50b7dc5360dbb8第二次提交
370e9cbb72feca9fb784843154f2171fefe2c656最初提交

太可笑了!我喜欢PowerCmd,也许只是不喜欢git。

解决方案

这些都是 ANSI转义序列(用于 ANSI颜色),而PowerCmd似乎不支持它们(如所述在该线程中



您可以尝试:

  git log --no-color 

这将允许您检查没有颜色时是否还有重复的提交。



我检查了:即使我设置了,输出也总是翻倍TERM = msys



我要让它运行的唯一方法是将stdout重定向到虚拟文本(不是 NUL ,而是实际的虚拟文件)

  C:\Users\vonc\prog\git\git> git log -2-无色--oneline>虚拟
f82887f Git 2.1-rc2
764c739合并分支'mb / relnotes-2.1'


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.

解决方案

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'

这篇关于为什么PowerCmd显示重复的git commit?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆