Search code examples
tortoisegit

Can you do partial commit in TortoiseGit?


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?


Solution

  • 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.

    enter image description here