我是 Windows 版 GitHub 的新手。我学习如何提交单个更改。 但我不明白如何才能只提交文件的一部分。 在 GitHub for Mac 上,您只需选择该行即可。
如何在 Windows 版 GitHub 上执行此操作?
最佳答案
更新:2015 年 1 月 14 日:Partial commits in GitHub for Windows :
The newest release of GitHub for Windows supports selecting lines or blocks of changes when creating a commit. Simply click the desired lines in the gutter, create the commit, and leave the other changes for you to continue working on.
GitHub 帖子添加了我在下面的原始答案中提到的内容:
<小时/>For people familiar with the command line, this change is similar to interactive staging using
git add -i
orgit add -p
.
(原始答案:2013 年 8 月)
从适用于 Windows 的 GitHub,您可以 open the console ,然后输入:
git add -p -- path/to/your/File
然后,您将能够准确地从该文件中暂存您想要的内容。
Interactively choose hunks of patch between the index and the work tree and add them to the index.
This gives the user a chance to review the difference before adding modified contents to the index.
关于git-commit - 适用于 Windows 的 GitHub : How to commit only a part of the file?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18516600/