git icon indicating copy to clipboard operation
git copied to clipboard

Update strategy of git aliases

Open sQVe opened this issue 5 years ago • 5 comments

Hey :wave:,

I think we need a strategy for how we keep the aliases here up to date with the git internals and best practices. An example it the new git switch and git restore which separates the two different common use cases of git checkout.

See:

  • https://github.com/git/git/blob/master/Documentation/RelNotes/2.23.0.txt
  • https://pawelgrzybek.com/til-git-switch-git-restore

The obvious alias for git switch would be Gs but that is already taken by git stash.

sQVe avatar Jan 25 '20 09:01 sQVe

Hi @sQVe! We sure need to incorporate these into the aliases. Good point!

For git switch, Gs, Gbs, GS and GbS are already taken. For git restore, Gr, Gwr, GR and GwR are also taken. I think these would be the first choices that make more sense. So we'll need to be more creative here, by choosing different 2 or 3 letter aliases, and/or by rearranging the existing ones.

The documentation for both commands in Git version 2.25 still say:

THIS COMMAND IS EXPERIMENTAL. THE BEHAVIOR MAY CHANGE.

So not sure if we should wait until the commands are established.

Ideas?

ericbn avatar Jan 25 '20 19:01 ericbn

I totally missed that they were listed as experimental. In that case I think we should wait until they are more established.

I still think this issue rings true in the sense that we need to start thinking about handling all the aliases we have. There're not that much room for "good" additions, especially if we do not want to rearrange or modify the existing ones.

I currently do not have any good suggestions which is most likely because I've been using these aliases for years and they are more ingrained in me than the normal commands.

sQVe avatar Jan 25 '20 20:01 sQVe

More than 2 years have passed and the documentation still says it's experimental (in git 2.37.0). Might be enough time already! :- )

What if we add new two-letter aliases for git switch and git restore?

I was thinking of Gh for git switch, and Ge for git restore. The last letters... ¯\_(ツ)_/¯

Then we go on adding the three-letter variations, like Ges for git restore --source for example...

Thoughts?

EDIT: I like how vim-unimpaired uses y for switch:

The mnemonic for y is that if you tilt it a bit it looks like a switch.

But since we're preferring letters that are part of the actual word, and the spelling is not actually swytch, then maybe it's not the right approach for us... (even x for delete can be thought as exclude...) Not sure.

ericbn avatar Jul 13 '22 02:07 ericbn

@ericbn I think your suggestions are fine and would work well. It will be nice to have these commands! 👌

sQVe avatar Jul 13 '22 12:07 sQVe

I didn't forget about this. I just didn't get used to the new aliases, so still experimenting with them. Gco is so buried into my muscle memory that's being hard to replace it... :- )

I'm feeling Gy is better than Gh for git switch because Gh alludes to GitHub.

ericbn avatar Aug 16 '22 21:08 ericbn