Native git allows partial commits: You can commit only some of the lines of your file and leave the rest for a later commit.
Is this possible in TortoiseGit?
Yes, there are official instructions in the docs.
In practice, I find this workflow useful:
Right click a file you want to partially commit Click Restore after commit - This immediately creates an internal copy of the file. Double click the file to edit in TortoiseGitMerge Right click -> Mark this block for each change you want to commit now Right click -> Leave only marked blocks to revert the other changes.
As an alternative to these two steps, you can edit the file the way you want. Save and Close TortoiseGitMerge Commit - this restores the internal copy of the file afterwards. The changes you just reverted in TortoiseGitMerge are now restored in your working tree.
The answer https://stackoverflow.com/a/32527098/3906760 is basically correct, however there are less steps required.
Choose Restore after commit in the context menu of the file you want to partially commit - This immediately creates an internal copy of the current state of the file. Now adjust the file to only contain the changes you want to commit This can be done using any editor you want to use, but also using TortoiseGitMerge: Double click the file to edit in TortoiseGitMerge (or your configured diff tool) Adjust the file to only contain the changes you want to commit. Save and Close Commit - this commits the selected files and restores the internal copy of the file - the original state of the file is now in your working tree again. These steps are required as TortoiseGit does not yet support the full staging process and hunk/block selection, cf. https://tortoisegit.org/issue/2299.
链接地址:
http://www.djcxy.com/p/4178.html
上一篇:
Git:提交部分更改
下一篇:
你可以在TortoiseGit中进行部分提交吗?