GitAlias / gitalias

Git alias commands for faster easier version control
2.45k stars 328 forks source link

[suggestion] git-commit with `--patch` #76

Closed micalevisk closed 2 years ago

micalevisk commented 2 years ago

in addition to those below

https://github.com/GitAlias/gitalias/blob/0cdf210d36c5a89c2886f078af44780ceb4a7a8b/gitalias.txt#L129-L144

what do you think of one alias for git commit --patch?

Use the interactive patch selection interface to choose which changes to commit.


I've been using cp but this one is taken by cherry-pick, thus I don't know what name it could have

https://user-images.githubusercontent.com/13461315/149058444-fd43b821-457f-4726-bcce-8790d97aa5cb.mp4

joelparkerhenderson commented 2 years ago

Yes you're correct. The alias "cp" is missing as "commit --patch" because it conflicts with "cp" as "cherry-pick". The alias "ci" is "commit --interactive" which is essentially a status screen then does the patches.

Historically, there are many of these missing aliases because of limited letters; for example, "r" for "rebase" vs. "reflog" vs. "remote" is an area where various people historically create aliases that would conflict.

For you personally, you can set "cp" to your "commit --patch" as you wish. One way to do this is described by the "customize" page at https://github.com/GitAlias/gitalias/blob/main/doc/customize/index.md

I'm curious what your workflow is like, and if you're using git aliases solo or with a team?

I ask because there's a special alias available "cc" that's intended to mean "commit the way my team wants". It's similar in spirit to the other doubled-letter aliases, such as "dd" meaning "diff the way my team wants", and "ll" meaning "log the way my team wants". Your "commit --patch" could plausibly be "cc" because it's the best way to commit IMHO.

micalevisk commented 2 years ago

got it.

I've been using git aliases by myself only. I just discover this repo and find that gitalias has few ones that I was using already thus I might start using it with the customize approach to keep the cp one. Thank you!