Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Committing specific parts of a file in Git [duplicate]

Tags:

git

Possible Duplicate:
How can I commit only part of a file in git

I have made several changes to a file and have also added it to the git index. While committing the file I realized that I actually have changes which should go in separate commits with other files.

Is there a way to commit only specific parts of this file in Git?

like image 374
Parag Avatar asked Jul 23 '09 09:07

Parag


2 Answers

Use:

git add -i

to add files interactively. This will allow you to stage only the parts of the files you wish to commit. More info here, and a decent tutorial here.

like image 146
Codebeef Avatar answered Nov 19 '22 03:11

Codebeef


Use git gui, it can add only specific parts of a file to the index. I think you can do it using git add -i (interactive mode) too, but I've never used it.

like image 32
Schnouki Avatar answered Nov 19 '22 03:11

Schnouki