我可以修改git-add的大块大小吗? [英] Can I modify git-add's hunk size?

查看:182
本文介绍了我可以修改git-add的大块大小吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个我一直在研究的文件,然后意识到我在上面几行的位置出现了一个错误。我很快修复了这个错误,并希望在我完成剩下的工作之前提交它。太棒了,这是git add --patch的用武之地!

I have a file that I've been working on and then realized that I had a mistake in it a few lines above where I've been working. I quickly fixed the mistake and want to commit it before I commit the rest of my work. Great, this is where git add --patch comes in!

除了这两个变化,我只有一个笨蛋。是否可以手动告诉git我想要两个hunk?

Except, I'm being presented with only one hunk incorporating both changes. Is it possible to manually tell git that I want two hunks?

推荐答案

除了'y'和'n'之外,当你问你一个大块头的时候你可以给出的答案是's',因为'把这个大块头分成小块'。完整列表:

In addition to 'y' and 'n', one of the answers you can give when it asks you about a hunk is 's', for 'split this hunk in to smaller hunks'. The full list:

y - stage this hunk
n - do not stage this hunk
q - quit, do not stage this hunk nor any of the remaining ones
a - stage this and all the remaining hunks in the file
d - do not stage this hunk nor any of the remaining hunks in the file
g - select a hunk to go to
/ - search for a hunk matching the given regex
j - leave this hunk undecided, see next undecided hunk
J - leave this hunk undecided, see next hunk
k - leave this hunk undecided, see previous undecided hunk
K - leave this hunk undecided, see previous hunk
s - split the current hunk into smaller hunks
e - manually edit the current hunk
? - print help

这篇关于我可以修改git-add的大块大小吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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