Best of Adam JohnsonSeptember 2024

  1. 1
    Article
    Avatar of adamjAdam Johnson·2y

    Git: avoid reset --hard, use reset --keep instead

    When undoing commits in Git, it's recommended to use 'git reset --keep' instead of 'git reset --hard' to avoid losing uncommitted changes. 'reset --hard' is highly destructive as it discards unsaved work, making recovery difficult. In contrast, 'reset --keep' preserves uncommitted changes and fails if it jeopardizes unsaved work. The post provides practical examples and suggests setting an alias for convenience.

  2. 2
    Article
    Avatar of adamjAdam Johnson·2y

    Python: my new uv setup for development

    uv is a new, speedy Python packaging tool that now manages both Python versions and Python-powered tools. The author switched to uv for Python and tool management, replacing Mise, pipx, and Pip, to streamline their development workflow. They use Ansible to automate the setup, including installing and upgrading Python versions and tools, and cleaning up old cache entries. The post provides specific Ansible tasks for these operations.