3 ms·
Wow, I have been using git for ages but I did not know about this. I was relying on magit (for Emacs) and git-cola.
by johnisgood 2y ago
Wow, I have been using git for ages but I did not know about this. I was relying on magit (for Emacs) and git-cola.
- ht85 2y agoYou can also discard changes that way, e.g.: git checkout -p -- .
- johnisgood 2y agoI will have to read about how to use it, because it shows some hunks on a page, and I do not want to stage all of them, for example.
- jeroen 2y agoWhen it shows you a hunk that's bigger than you like, you can use 's' to split it into smaller hunks.
- johnisgood 2y agoThank you!
- harry_ord 2y agoCherrypick (-p) is wonderful. A command I also like is rebase interactive(-I) Git rebase -i HEAD~[number of commits]
- johnisgood 2y agoYeah, I use `git rebase -i HEAD~n` a lot.
- masklinn 2y agoMagit does interactive staging (and unstaging) a lot better than git itself does. In d u, you can “s” on a file or hunk and it’ll stage just that. And if you select lines (c-spc?) it’ll stage just those lines. To unstage, go to d s and use “u” the same way. The massive advantage aside from line-wise staging is that you don’t need to stage linearly.