Commit only part of a file in Git

后端 未结 23 2310
一整个雨季
一整个雨季 2020-11-22 05:50

When I make changes to a file in Git, how can I commit only some of the changes?

For example, how could I commit only 15 lines out of 30 lines that have been changed

23条回答
  •  梦如初夏
    2020-11-22 06:40

    I would strongly recommend using SourceTree from Atlassian. (It's free.) It makes this trivial. You can stage individual hunks of code or individual lines of code quickly and easily.

    enter image description here

提交回复
热议问题