Commit only part of a file in Git

后端 未结 23 2296
一整个雨季
一整个雨季 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:20

    Tried out git add -p filename.x, but on a mac, I found gitx (http://gitx.frim.nl/ or https://github.com/pieter/gitx) to be much easier to commit exactly the lines I wanted to.

提交回复
热议问题