我正在处理一个大型Web项目,其中包含大量代码,用于执行RESTful API,身份验证等。大型团队可以完成所有这些工作。我只从事该项目的科学计算内核,一个目录中约有20个文件。
有没有办法在两个分支之间做一个“ git diff”,只限于单个目录中的那些文件?
如果我执行'git diff master my_branch',我会在数百个与我无关的文件中看到差异。当然,我可以通过执行'git diff master my_branch-file1','git diff master my_branch-file 2'等在我关心的目录中逐个文件地执行此操作,但这非常繁琐。
我想做的基本上是'git diff master my_branch-/root/foo/scientific_modules/*.py'或类似的东西。
答案 0 :(得分:0)
假设目录名称为“ root”,并且您正在其中执行命令,只需从path选项中排除“ root”(例如您的问题中的示例):
# produce plots for all the pids
for (i in 1:n_pids){
print(paste0('working on ', i, ' pid ', def_dates$pid_names[i]))
pidx <- def_dates[i,'pid']
sub <- res[pid == pidx]
png(file = paste0(pidx, '-misrated.png'), width = 750, height = 350, units = "px", pointsize = 12 )
par(oma = c(5, 1,1,1), mar=c(0,3,3,3))
with(sub, plot(date, edf1/100,
type="l", col="blue",
ylim=c(0,.5), bty='n',
xlab=NA, ylab=NA, cex=0.9,lwd=2,
axes=F,xaxs = "i",yaxs="i",
panel.first =
c(abline(h = seq(0,1,.1), lty = 2, col = 'grey')
,NULL)
))
abline(v=as.Date(def_dates[def_dates$pid == pidx,'def'],'%m-%d-%Y'),
col="red",lwd=2)
axis.Date(1, at = seq(min(sub$date), max(sub$date), length.out = 10),
format= "%b %Y") # bottom dates
var1= seq(0,0.5,.1)#pretty_breaks(n=5)(sub$edf1/100)
axis(2, lwd=0,
at=var1,
label=percent(var1),
las=1) # EDF values
par(new=T)
with(sub, plot(date, displaystring, type="l",
col="darkgreen", lwd=2,
axes=F, xlab=NA, ylab=NA))
axis(side = 4,
at=seq(1,NROW(unique(sub$displaystring))),
labels=unique(sub$displaystring),
lwd=0,cex=0.5,las=1,
col="darkgreen"
)
par(oma = c(0,0,0,0))
legend("bottom", legend=c("DENBURY RESOURCES INC [1-Yr EDF9]","MIS RATING"), xpd = TRUE,
horiz = TRUE,
inset = c(0,0), bty = "n",
col=c("blue", "darkgreen"), lty=1, cex = 1)
dev.off()
#ggsave(paste0(pidx, '-rated.png'), p, scale=3, height=3, width=6, unit="in")
}