gitalias icon indicating copy to clipboard operation
gitalias copied to clipboard

Proposal: `git aacanepush`

Open hyperupcall opened this issue 1 year ago • 12 comments

When working with CI, it is common to make edits and and force push those changes to CI. I propose an alias to shorten three commands to do so, into one: git aacanepushy

git aa: git add --all git cane: git commit --amend --no-edit git pushy: git push --force-with-lease

I have a similar personal alias: git aacamnepf, that I use almost every day. So I thought something like that might be useful to other people. If there is interest, I'll gladly make a PR

hyperupcall avatar Nov 18 '23 22:11 hyperupcall

Neat! This is the first time someone's doing this. Good initiative Sure, go for it.

For your PR, can you also add an description of how & when you use it? (Or when a developer would want to use it?)

joelparkerhenderson avatar Nov 20 '23 01:11 joelparkerhenderson

The name aacanepushy is too long for my taste and unreadable. :-(

phdru avatar Nov 24 '23 11:11 phdru

@phdru What do you feel is a better name?

joelparkerhenderson avatar Nov 25 '23 20:11 joelparkerhenderson

Ouch, that a hard question! I hope you remember the joke about 2 hard problems: https://martinfowler.com/bliki/TwoHardThings.html

«Cache invalidation, naming things, and off-by-1 errors.»

What about git addamendpush? git add-amend-push?

phdru avatar Nov 25 '23 20:11 phdru

Ha! Yes you're right. Perhaps brainstorm the purpose?

Yes I worked with Martin for a bit. My team had this... The four hard things concurrency in computer science are naming things, exactly-once delivery, cache invalidation, exactly-once delivery, and off-by-one errors.

joelparkerhenderson avatar Nov 25 '23 21:11 joelparkerhenderson

git acap for add/commit-amend/push?

Even shorter git aap?

phdru avatar Nov 25 '23 21:11 phdru

git acap sounds good! Another alternative is acp for "add, commit, push".

hyperupcall avatar Nov 29 '23 06:11 hyperupcall

Good brainstorming. How about some ideas that are words for the purpose, intent, or goal?

Shorthands such as "acp" are hard, because what you're aiming to do is an atypical add (i.e. add all), an atypical commit (i.e. commit amend no edit), and an atypical push (with a force). In a well-managed codebase, this should be a highly rare event that's a bit like a big sledgehammer, and a bit unlike a precision scalpel, yes?

Or, if this is more frequent, then is it possibly an aspect of a typical workflow, such as your usual workflow to trigger a topic branch CI? Could any of the gitalias topic-* aliases help here?

joelparkerhenderson avatar Nov 29 '23 22:11 joelparkerhenderson

True haha, the command is like a sledgehammer. I don't think that the topic-* aliases would apply here since this command is meant to be used forcibly on an existing branch, rather than create a new one. But, this could be better placed under the "misc" section under "workflow aliase".

Using words that serve intent or purpose, ideas include git commit-all-and-push ('commit-all' referring to 'commit -a'), git force-push-tracked, or git commit-amend-tracked-and-pushy. It is difficult to come up with something that is both short and memorable.

hyperupcall avatar Dec 05 '23 03:12 hyperupcall

What I mean by intent, is things more like... how would you describe this to someone who doesn't know git, what are you doing that makes these commands helpful, or what names could you use to explain the situation that you would be in that make these commands good?

As just some examples of ones that I personally use for my own aliases like this... yikes, oops, rescind, unbotch, or a bunch of wizard spell names, or Latin & Greek words, or made-up expressions, or a suffix, etc.

You're able to see some of these in GitAlias, such as purpose ones (e.g. churn, hew), situational ones (e.g. panic, wip), spell-like ones (e.g. publish, serve), suffix ones (e.g. initer, repacker).

joelparkerhenderson avatar Dec 05 '23 20:12 joelparkerhenderson

Ohh, I see - so something more semantic and/or situational.

  • git retry or (retry-ci) would describe the situation in which CI fails, and you want to "retry" it with new code
  • git replace-tip describes what the alias does at a high-level, without using git terms. You have a history of changes, and you want to replace the most recent change (tip) (HEAD, origin/HEAD) with your current changes
  • git override - similar to the second bullet point; different name

I think git retry-ci sounds the best to me. What do you think?

hyperupcall avatar Feb 01 '24 03:02 hyperupcall

Excellent! Your new suggestions are better, clearer, more semantic, more situational.

You're describing your situation where you want to make amends, to compensate for your previous bad/unwanted CI failure run, and to supply satisfaction for a new CI run.

There's a word that means what you're writing: atone.

See https://www.merriam-webster.com/dictionary/atone and the "Did you know?" section too.

I would be stoked to have your new alias be "git atone". What do you think?

joelparkerhenderson avatar Feb 01 '24 06:02 joelparkerhenderson