git-commit - 适用于 Windows 的 GitHub : How to commit only a part of the file?

标签 git-commit github-for-windows

我是 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.

https://cloud.githubusercontent.com/assets/359239/5745722/ab3d336e-9bdf-11e4-8001-fc7316e8155b.gif

GitHub 帖子添加了我在下面的原始答案中提到的内容:

For people familiar with the command line, this change is similar to interactive staging using git add -i or git add -p.

<小时/>

(原始答案:2013 年 8 月)

从适用于 Windows 的 GitHub,您可以 open the console ,然后输入:

git add -p -- path/to/your/File

然后,您将能够准确地从该文件中暂存您想要的内容。

git add --patch :

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/

相关文章:

git - 如何在我的存储库中提交克隆的子模块?

git - 防止 git 在丢失时自动生成用户电子邮件

git - 如何使用 git interactive rebase 签署一系列提交

git - SmartGit/Hg 4.6.2 Head 未指向有效提交

python - Github 桌面和 git hooks

github - 如何在 GITHUB 中隐藏提交

github - 如何通过 GitHub API 获取 Git 标签中的所有提交

git - 对已 git 添加然后 git 提交的文件进行更改似乎工作得很好

git - 如何在 Windows 7 中更改 git shell 的启动目录

github - 如何使用 GitHub 客户端设置身份验证?