简体   繁体   English

在Git中模块化地暂存文件

[英]staging files modularly in Git

I have just started using Git. 我刚刚开始使用Git。 From my previous experience from using Perforce, I want to know if i can stage the files in sections of user stories/tasks so that I can commit only specific files ? 根据我以前使用Perforce的经验,我想知道是否可以在用户故事/任务的各个部分中暂存文件,以便仅提交特定文件? If so how to do this. 如果是这样,该如何做。 I might be working on different user stories at the same time. 我可能同时在处理不同的用户故事。

Regards, Pradeep 问候,Pradeep

Yes, you can add to your index only specific file ( git add -- afile ). 是的,您只能将特定文件( git add -- afile )添加到索引中。

But you even can add specific portion of a file ( git add -p -- afile ), up to a specific line . 但是您甚至可以添加文件的特定部分( git add -p -- afile ), 直到特定的行

In both case, adding to the index helps you to prepare the next commit. 在这两种情况下,添加到索引都可以帮助您准备下一次提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM