Skip to main content

3 posts tagged with "programming"

View All Tags

__init__.py use cases in Python

· 5 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

__init__.py is a special file that designates a directory as a Python package. You can leverage it to perform powerful package-level operations that go beyond a simple empty file, including managing the public API, handling circular dependencies, and dynamic module loading.

How to fix a Git detached HEAD?

· 6 min read
Serhii Hrekov
software engineer, creator, artist, programmer, projects founder

To fix a detached HEAD in Git, you need to save your work by creating a new branch or by checking out an existing one. A detached HEAD occurs when you check out a specific commit, tag, or a remote branch's commit instead of a local branch name (1). In this state, any new commits you make are not part of any branch, making them easy to lose.

The HEAD pointer in Git usually points to the tip of a branch (e.g., main, feature-a). A detached HEAD means the pointer is pointing directly to a commit instead of a branch.