Posts

Showing posts from October, 2020

How to re-tag something in git

I make mistakes. One of the more annoying ones I make, is to push a release with the wrong tag, causing all sorts of issues. Here's how to re-tag things in git: Use git reflog to find the thing you want to re-tag (likely one of the most recent ones) - jot down the number (e.g.  a2a6ebea2 ) Use   git describe  a2a6ebea2  to double check that it points to your misconfigured release (e.g.  releases/ product name / version number ) Get your tag names with ( git for-each-ref --sort='-taggerdate' --format='%(tag),%(taggerdate:iso8601),%(refname),' "refs/tags/releases/**" ) Delete the erroneous tag with git tag --delete tag name Create a new tag with git tag --annotate " new tag name " a2a6ebea2 --message " Version NNNN " Push the deletion of the old tag with git push origin :refs/tags/ old tag name Push the creation of the new tag with git push --tags

Highly Declarable React #dont-make-me-think #hdr

Here's something I recently discovered and that I'm proud of; not because it's technically superior, but instead because it's much easier for the human to deal with. I present to you  H ighly D eclarative R eact     The idea is that your component declare its various states up front, making it easy to reason about function GenerateAuthTokenForm ({isOpen, setIsOpen}: GenerateAuthTokenFormParams ) { ... const [state, dispatch] = useReducer((state: { mode: string }, response: any) => { ... } ... return < SomeContainerElement>      < ShowProgressWhenUserClicksGenerate />      < ShowSuccessAfterTokenCreated />      < ShowInputUiByDefault />      < ShowErrorWhenTokenGenerationFails />      < NotifyWhenUserTriesToCreateNamelessToken />      < ButtonPanel onCancel = {() => setIsOpen( false )} onConfirm = { handleSubmit } />      </ SomeContainerElement > ); } Each element checks the local page state to see if it should re