英文:
Fetching json content from a git diff command result
问题
Sure, here's the translation of the content you provided:
Git diff tag1.2 tag1.5
上述命令的输出为
**标签
一些字符
@@262728
{
'Code-version':'1.5',
'changes':[
'code-repo':'2.1']
}
**标签
一些字符
@@262728
{
'Code-version':'1.4',
'changes':[
'code-repo':'2.0']
}
**标签
一些字符
@@262728
{
'Code-version':'1.3',
'changes':[
'code-repo':'1.9']
}
我需要仅显示最新的 JSON 内容,如下所示,不包括其他不需要的内容
{
'Code-version':'1.5'
'changes':[
'code-repo':'2.1']
}
英文:
Git diff tag1.2 tag1.5
Output for the above command is
**Tag
Some character
@@262728
{
'Code-version':'1.5',
'changes':[
'code-repo':'2.1']
}
**Tag
Some character
@@262728
{
'Code-version':'1.4',
'changes':[
'code-repo':'2.0']
}
**Tag
Some character
@@262728
{
'Code-version':'1.3',
'changes':[
'code-repo':'1.9']
}
I need to display only the latest json content like below excluding other unwanted stuffs
{
'Code-version':'1.5'
'changes':[
'code-repo':'2.1']
}
答案1
得分: 1
如果您对特定标签(或提交)下文件的内容感兴趣,您可以使用 git show
命令:
git show 标签名:路径/至/文件
git diff
显示文件的两个不同版本之间的差异,但您只关心文件的一个特定版本。
英文:
If you are interested in the content of a file at a specific tag (or commit), you can use git show
:
git show tagname:path/to/file
git diff
shows the difference between two revisions of a file, but you are only interested in one specific version of the file.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论