我想使用AnsiColorLogger从Ant获取颜色输出.我在Windows上使用Git Bash.
我试过了:
$ ant -logger org.apache.tools.ant.listener.AnsiColorLogger
Run Code Online (Sandbox Code Playgroud)
但我的输出看起来像:
Buildfile: c:\foo\build.xml
?[2;36m [junit] Testsuite: org.foo.BarTest?[m
?[2;36m [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 0.188 sec?[m
?[2;36m [junit] ?[m
?[2;36m [junit] Testcase: testInherits took 0.175 sec?[m
?[2;36m [junit] FAILED?[m
?[2;36m [junit] subdir not child?[m
?[2;36m [junit] junit.framework.AssertionFailedError: subdir not child?[m
?[2;36m [junit] at org.foo.BarTest.testInherits(BarTest.java:61)?[m
?[2;36m [junit] ?[m
?[2;31m [junit] Test org.foo.BarTest FAILED?[m
Run Code Online (Sandbox Code Playgroud)
我知道ANSI颜色至少部分地在Git Bash中起作用,因为命令会ls -ACF --color=auto产生很好的彩色输出.
Ant的诀窍是什么?
所以我刚刚从Ubuntu迁移到Windows(由于兼容性问题,读取被迫移动)并使用Git Bash来提取我的文件.我注意到一些非常奇怪的事情.
安装了Git Bash C:\Program Files (x86)\Git\,当我第一次运行Git Bash程序时,默认位置就是这个.正常吗?对.
但这是奇怪的部分..
当我运行命令mkdir srv在Git的bash命令行,我可以看到它在Bash的窗口-但我不能看到它在Windows资源管理器?有没有搞错.vi在CLI中创建的文件也会发生同样的事情.在Windows资源管理器中不可见.(是的,我Show hidden files在资源管理器中启用了该选项,所以不是这样).
这是一些快照(不,我不是盲目的 - 我也不是疯了).救命?

我正在使用win 7和git bash以及亚马逊EC2实例.我试着登录我的实例:
$ ssh -i f:mykey.pem ubuntu@ec2-52-10-**-**.us-west-2.compute.amazonaws.com
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
71:00:d7:d8:a------------------26.
Please contact your system administrator.
Add correct host key in /m/.ssh/known_hosts to get rid of this message.
Offending …Run Code Online (Sandbox Code Playgroud) 我写的这个bash脚本有问题.我试图从Github文档应用此过程的第3步,从我们的git历史记录中删除我们的存储库历史记录中的所有文件.例如,如果.gitignore忽略.txt,我想从历史记录中删除所有.txt.对于每个.gitignore行等等.
我可以在示例文件中使用通配符.所以我可以运行以下命令删除所有.txt文件:
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch *.txt' --prune-empty --tag-name-filter cat -- --all
Run Code Online (Sandbox Code Playgroud)
所以我试着制作一个bash脚本来做同样的事情.
我制作了一个简单的.gitignore文件来测试它,如下所示:
#foo
*.txt
*.docx
Run Code Online (Sandbox Code Playgroud)
我的shell脚本如下所示:
#!/bin/bash
s1="#"
str1="'git rm --cached --ignore-unmatch "
str2="'"
cat .gitignore | while read line
do
if [[ $line == *"$s1"* ]]
then
echo #skip
else
str3=$str1$line$str2
git filter-branch --force --index-filter $str3 --prune-empty --tag-name-filter cat -- --all
fi
done
Run Code Online (Sandbox Code Playgroud)
但是,这会产生以下输出:
fatal: bad revision 'rm'
fatal: bad revision 'rm'
Run Code Online (Sandbox Code Playgroud)
(对于.gitignore文件的每一行一次)
我做错了什么?
我目前正在Windows 7上使用GitBash来使用命令行界面,并且非常有兴趣知道如何使用GitBash在其默认程序中打开文件/文档.
我正在尝试通过php安装composer,如他们的wesite所述.
php -r "readfile('https://getcomposer.org/installer');" | php
Run Code Online (Sandbox Code Playgroud)
但它显示以下错误:
$ php -r "readfile('https://getcomposer.org/installer');" | php
output is not a tty
input is not a tty
Run Code Online (Sandbox Code Playgroud)
我在Windows 7中并使用git bash来执行此命令.在Windows命令提示符下,它工作正常.只有从git bash 2.6.2-64bit运行此命令时才会出现此问题.
顺便说一下,我已经为windows安装了composer,这很好用.但我无法以这种方式下载composer.phar.我该如何解决这个问题?
如何在Git中重命名现有的带注释标签?
我有几百个标签代表存储库中的版本号,每个标签都注释有关该版本更改内容的有用描述.我想更改我用于这些标签的命名方式,记录标签消息,删除标签,并使用旧消息和新名称重新创建它将是一个噩梦,手动做近百个标签.执行此操作的脚本或一系列git命令对自动化很有用.
情况1:使用变量名而不是值
package.json:
{
"name": "example",
"config": {
"url": "localhost/dev"
},
"scripts": {
"watch": "browser-sync start --files \"./**/*, !.node_modules/, !src\" --proxy $npm_package_config_url"
}
}
Run Code Online (Sandbox Code Playgroud)
$npm run watchhttp://localhost:3000/$npm_package_config_url在浏览器中打开,而不是http://localhost:3000/dev
因此,$npm_package_config_url用作字符串,而不是变量.
案例2: 命令替换不起作用
{
{ ... },
"scripts": {
"rm:all": "npm rm $(ls -1 node_modules | tr '/\\n' ' ')"
}
}
Run Code Online (Sandbox Code Playgroud)
子命令列出node_modules中的文件夹.
再一次,npm run rm:all什么也不做,因为$(ls -1 node_modules | tr '/\\n' ' ')被解释为文件夹名称.
ENV:windows 10 | npm 3.5.1 | 节点4.2.2 | git-bash 2.6.0
如何在HEAD 之前引用提交?
例如,在 HEAD 后面提交1次的提交是HEAD~1.
相对于HEAD,我如何向相反的方向移动?
基本上,我做了git checkout HEAD~13次.现在我想向前推进1次提交,有效地撤消我的最后一次提交git checkout HEAD~1.我怎样才能做到这一点?
我知道提交的一个分支就像一个单独的链表,每个提交只指向它的父.因此,如果遍历提交的孩子是不合理的,我想知道如何在他们之间进行处理.
什么是点git add .或git add <filename>将其添加到临时区域?为什么不 git commit -m "blabla"呢?
我不明白临时区域的价值.
git-bash ×10
git ×5
windows ×3
bash ×2
amazon-ec2 ×1
ant ×1
composer-php ×1
file ×1
git-branch ×1
git-checkout ×1
git-commit ×1
github ×1
msys ×1
node.js ×1
npm ×1
package.json ×1
php ×1
repository ×1
sh ×1
ssh ×1
tags ×1