Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I rarely use git add (basically only for new files or non-text files) and instead always use commit --patch.


What do you do when you come across lines that you want to commit, but edit beforehand? I always run into syntax errors when I use `e` to edit a diff during `git add -p`, and it doesn't update the file in the working tree, which I also want. Skip it and then `commit --amend`?


A tiny change like a typo in a comment I would just edit in both the git commit --patch `e` editor and in the working tree copy. Anything bigger I'd either abort or skip and edit/test normally and then amend. My main use for `e` are not really edits to the final code but rather for splitting up changes that affect the same line.

I only had problems with errors from `e` on Windows - I'm guessing due to wrong line endings.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: