我希望git diff输出所有文件的常规差异,除了*.tex.对于*.tex文件,我想看看输出git diff --word-diff.
我和玩弄.gitattributes和.gitconfig,但我得到了最远的是得到一个.tex文件中的部分显示,随后坠毁.
有可能得到这种行为吗?
我的.gitattributes:
*.tex diff=latex
Run Code Online (Sandbox Code Playgroud)
.gitconfig:
[diff "latex"]
wordRegex = "\\\\[a-zA-Z]+|[{}]|\\\\.|[^\\{}[:space:]]+"
command = ~/bin/word-diff.sh
Run Code Online (Sandbox Code Playgroud)
并且word-diff.sh:
#!/bin/sh
git --no-pager diff --color-words "$2" "$5"
Run Code Online (Sandbox Code Playgroud) 我最近拆分了我的存储库(驻留bigproj)使用git filter-branch --subdirectory-filter deep/in/my/project.然后,我将.git目录移动到deep/in/my/project.
现在,藏匿处处于一种奇怪的状态,其中顶部存储类似于:
stash@{0}: filter-branch: rewrite
Run Code Online (Sandbox Code Playgroud)
我不能放弃这个藏匿,因为我得到这个错误(之后git stash drop):
refs/stash@{0}: not a valid stashed state
Run Code Online (Sandbox Code Playgroud)
现在,即使我知道存储@ {1}的refid,它仍然包含bigproj层次结构中文件的差异.是否可以重写存储数据,以便它只包含属于deep/in/my/project层次结构的文件?
我想将更改从分支B合并到我的分支A,以便合并排除对给定目录的任何更改.这里的问题是我有一些提交跨越多个目录的更改,其中一个需要被排除.
这样的事情是否可能,例如历史改写?
为了澄清,我的目录结构是:
root/x
root/y
root/z
Run Code Online (Sandbox Code Playgroud)
一些提交会影响所有三个目录.现在,我想以这样的方式,我在历史上都改变为合并y和z,但不x.
我用我的共享存储库的本地副本做了一系列愚蠢的步骤,我正在寻找一种方法来解决它.步骤是:
我使用书签来拥有开发分支的多个头,其他人使用:
-o---o---o-----o--- <- dev branch
\----1----1------ <- another head of the dev branch,
where I committed stuff
Run Code Online (Sandbox Code Playgroud)一段时间后,我创建了一个新的分支,仍然是本地的
/---------------x <- new branch
-o---o---o-----o--- <- dev branch
\----1----1------ <- another head of the dev branch,
where I committed stuff
Run Code Online (Sandbox Code Playgroud)对于一个只包含我的代码的头,我在另一个分支上做了一个rebase
/-1'--1'-- <- rebase
/---------------x <- new branch
-o---o---o-----o--- <- dev branch
\----1----1------ <- another head of the dev branch,
where I committed stuff
Run Code Online (Sandbox Code Playgroud)然后,我合并了rebase,然后,几次提交,我合并默认
----------d-\ <-default
\
/-1'--1'\ \
/---------------x--------x--x-x-x-- <- new branch
-o---o---o-----o---
\----1----1------
Run Code Online (Sandbox Code Playgroud)现在,我想将我的新分支推送到服务器( …
我正在尝试添加新列data.table,其中行中的值取决于行中值的相对关系.更确切地说,如果一行中有一个值X,我想知道在X-30中有多少其他值在同一列(和组)中.
就是这样:
DT<-data.table(
X = c(1, 2, 2, 1, 1, 2, 1, 2, 2, 1, 1, 1),
Y = c(100, 101, 133, 134, 150, 156, 190, 200, 201, 230, 233, 234),
Z = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12))
Run Code Online (Sandbox Code Playgroud)
我想获得一个新列,其值为:
N <- c(0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 1, 2)
Run Code Online (Sandbox Code Playgroud)
我尝试了以下内容,但我没有得到我可以使用的结果:
DT[,list(Y,num=cumsum(Y[-.I]>DT[.I,Y]-30),Z),by=.(X)]
Run Code Online (Sandbox Code Playgroud)
任何想法如何做到这一点?
我刚开始学习lua,所以我的要求可能是不可能的。
现在,我有一个接受函数的方法:
function adjust_focused_window(fn)
local win = window.focusedwindow()
local winframe = win:frame()
local screenrect = win:screen():frame()
local f, s = fn(winframe, screenrect)
win:setframe(f)
end
Run Code Online (Sandbox Code Playgroud)
我有几个接受这些框架和矩形的函数(仅显示一个):
function full_height(winframe, screenrect)
print ("called full_height for " .. tostring(winframe))
local f = {
x = winframe.x,
y = screenrect.y,
w = winframe.w,
h = screenrect.h,
}
return f, screenrect
end
Run Code Online (Sandbox Code Playgroud)
然后,我可以执行以下操作:
hotkey.bind(scmdalt, '-', function() adjust_focused_window(full_width) end)
Run Code Online (Sandbox Code Playgroud)
现在,我如何adjust_focused_window在不更改其定义的情况下将多个函数组合为 。就像是:
hotkey.bind(scmdalt, '=', function() adjust_focused_window(compose(full_width, full_height)) end)
Run Code Online (Sandbox Code Playgroud)
where将返回一个接受与和compose2相同参数的函数,并在内部执行类似以下操作:full_widthfull_height
full_height(full_width(...))
Run Code Online (Sandbox Code Playgroud)