Is it possible in SourceTree commit only one “hunk” of changes?

Is it possible in sourcetree commit only one “hunk” of changes? As I see I can dismiss a “hunk” of changes, but I can not commit them.

  • Resolving git conflicts: git mergetool doesn't work
  • How to use Interactive Rebase in SourceTree 1.6
  • Aptana, SourceTree and Git - Beginner
  • Does Git generally choke on mounted drives? Or just Git GUI's?
  • Git Changes to file lost after merge with remote (SourceTree, GitHub)
  • 'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository
  • Undo a merge that has been pushed
  • Is there a right way to combine two commits that are not in order?
  • Opposite of .git/info/exclude - including files that are excluded by .gitignore
  • Can I use .gitignore_global to ignore file for all users over multiple repos?
  • How to set master feature branch as default in Teamcity 9.1
  • Filter issues on Github that will be closed by a pull request?
  • One Solution collect form web for “Is it possible in SourceTree commit only one “hunk” of changes?”

    Yes, you can selectively stage blocks (also known as “hunks”) of code to be committed using git and SourceTree. Here is an example:

    enter image description here

    In the image above, I have selected to view changes in my working copy. 2 hunks are displayed. In the first hunk, I selected 2 specific lines, which I can then selectively stage to be committed. Note that you can only stage consecutive lines at a time with this method, so if you want to selectively stage non-consecutive lines, you have to select them 1 at a time.

    For the 2nd hunk, instead of staging individual lines, I can instead choose to stage the entire hunk.

    After you’re done staging the lines or hunks of code that you want, anything remaining unstaged changes will remain in your working copy, but won’t be committed until you stage them too. It is in this way that you can selectively pick lines or hunks of code to be committed from your modified working copy.

    Git Baby is a git and github fan, let's start git clone.