如何在git中非交互式地分块? [英] How to stage chunks non-interactively in git?

查看:101
本文介绍了如何在git中非交互式地分块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用以下任何命令添加块:

  git add -i 
git add - -patch
git add --edit

但是我可以获取所有文件的大小

  git --no-pager diff file1> / tmp / stageme 

我可以看到三个区块,我只需要第一个和最后一个区块,第二块文件 / tmp / stageme



如何在命令中将这些块分段? 我的意思是,我如何从 / tmp / stageme ?>

解决方案

我发现我可以做到 git apply 命令

  git apply --cached / tmp / patchme 


I know I can add chunks using any of the following commands

git add -i
git add --patch
git add --edit

But I can get all chunks for a file

git --no-pager diff file1 > /tmp/stageme

I can see three chunks I want only the first and last chunks, so I remove the second chunk the file /tmp/stageme

How I can stage those chunks in a command? I mean, how can I stage the info from /tmp/stageme?

解决方案

I found I can do it the the git apply command

git apply --cached /tmp/patchme

这篇关于如何在git中非交互式地分块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆