Practical Git via GitExtensions
  • Git - a Distributed System
  • Bare Minimal Configurations
  • Creating a New Branch
  • Making a Commit
    • Adding only a portion of a file
    • Commit Message
    • Cherry-pick
    • Revert
  • Rewriting History
    • Rewording the Last Commit
    • Rewording Commit Message in Middle
    • Editing the Last Commit
    • Squashing Last Few Commits
    • Squashing Commits in Middle
    • Spliting Commit into Multiple
    • Removing a Commit
    • Pushing after Rewriting History
  • Lost and Found
  • Comparing Commits or Branches
  • Checking out a Branch into Another Folder
  • Blaming History
    • Blame
    • Bisect
  • Disabling Auto Tracking Branch
  • Line Ending
  • Ignore Unwanted Files
Powered by GitBook
On this page

Was this helpful?

  1. Making a Commit

Adding only a portion of a file

PreviousMaking a CommitNextCommit Message

Last updated 6 years ago

Was this helpful?

See

In the commit dialog, we do not have to commit all of the changes of a file. In the diff view on the right, we can select individual lines for the next commit, and press the [S] key or the Stage context menu item to add the lines to the staging area.

You may want to turn the ignore white space options off which can be located at the dock bar on the right top of the diff view when the view is focused.

Command line:

git add -i
# or
git add --interactive
https://git-extensions-documentation.readthedocs.io/en/latest/commit.html#staging-selected-lines