删除git pull
冲突文件
如zig在某次更新时,出现如下错误:
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (1/1), 653 bytes | 32.00 KiB/s, done.
From https://hub.fastgit.org/ziglang/zig
81e2034d4..594271f8d master -> origin/master
Updating 81e2034d4..594271f8d
error: Your local changes to the following files would be overwritten by merge:
CMakeLists.txt
doc/langref.html.in
src/AstGen.zig
src/Sema.zig
src/Zir.zig
test/behavior.zig
test/compile_errors.zig
Please commit your changes or stash them before you merge.
Aborting
将错误信息导出到某个文件:
git pull 2>pull.txt
编译gitmerge.vsh
脚本:
#!/usr/bin/env -S v run
println('gitmerge v0.0.1 by Zhuo Nengwen at 2021-09-02\n')
args := args_after('')
if args.len > 1 {
file_name := args[1]
content := read_lines(file_name) ?
for _, name in content[1..content.len - 2] {
new_name := name.trim_space()
cmd := 'rm $new_name'
println(cmd)
system(cmd)
}
}
然后执行:
gitmerge pull.txt
将删除所有冲突文件,再执行git pull
正常更新。