![]() You can prevent staging the modification by converting "-" lines to Modified content is represented by "-" lines (removing the oldĬontent) followed by "+" lines (adding the replacement content). Prevent staging their removal by converting the "-" to a " " Removed content is represented by lines beginning with "-". Prevent staging any addition lines by deleting them. This is what git add -h says about adding files this way (patching files):Īdded content is represented by lines beginning with "+". To not stage a deletion just replace - with space.To not stage an addition just delete that line.Reference for future: Git Tools - Interactive StagingĪdding on a previous answer, if you prefer using the command line, entering git add -e myfile gives you the choice to choose line by line what you want to commit because this command will open an editor with the differences, like so:Īs you may known lines that start with + are addtions, lines that start with - are deletions. Note this is far different than the git format-patch command, whose purpose is to parse commit data into a. git commit -v to view your commit while you edit the commit message.git reset -p to unstage mistakenly added hunks.git diff -staged to check that you staged the correct changes.Afterwards you can go on with git add -p. If the file is not in the repository yet, you can first do git add -N. You can then edit the hunk manually by replacing +/ - by # (thanks veksen).s split the current hunk into smaller hunks.K leave this hunk undecided, see previous hunk.k leave this hunk undecided, see previous undecided hunk.J leave this hunk undecided, see next hunk.j leave this hunk undecided, see next undecided hunk./ search for a hunk matching the given regex.d do not stage this hunk or any of the later hunks in the file.a stage this hunk and all later hunks in the file.q quit do not stage this hunk or any of the remaining hunks. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |