Skip to main content

Git: Discard All Local Changes and Get a Fresh Copy from GitHub

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

A common and reliable way to get a fresh copy from a GitHub repository, while preserving specific local files like .gitignore, is to use a combination of git reset and git clean. This approach ensures your local branch exactly mirrors the remote branch, without leaving behind any untracked or unwanted files.

Discard all local changes and pull the latest version from a GitHub

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

To discard all your local changes and pull the latest version from a GitHub repository, you need to completely reset your local branch to match the remote's state. This process involves a few steps to ensure all uncommitted and committed local changes are removed.

This guide covers the most reliable methods, including situations where you've already made local commits.

VIM Commands Cheatsheet

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

VIM Commands Cheatsheet no water, just straight to the point, such as - how to save and exit vim editor?!

ZSH: permission denied

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

zsh: permission denied: /Users/username/.zshrc occurs because your user account doesn't have the necessary file permissions to write to or execute the .zshrc file. This is a common issue after certain system updates, migrations, or when a file is created with elevated privileges.

To solve this, you need to change the file's ownership or permissions.

Conventional Commits Cheat Sheet 2025

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

Conventional Commits is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an explicit commit history, which makes it easier for automated tools to parse and for humans to understand (1).

Ultimate pre-commit Configuration for Python

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

Maintaining a clean and consistent codebase is crucial for any successful project. Enforcing standards across your team can be challenging, but with pre-commit, you can automate this process directly into your development workflow. This guide outlines a powerful pre-commit configuration that combines formatting, linting, and static type checking to ensure your code is always in top shape.

A Guide to Preserving YAML Formatting with PyYAML

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

Python's PyYAML library is a powerful tool for working with YAML, but it has one common limitation: when you load a YAML file and dump it back, it doesn't preserve the original formatting. This can be a problem if you have multi-line strings formatted as literal blocks (|) and want to keep them that way for readability.

Fortunately, there's a straightforward and effective way to solve this by creating a custom representer for PyYAML. This guide will walk you through the process, using the code you provided, to ensure your multi-line strings are always dumped as literal blocks.

Preserve the original literal block format

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

No, it is not possible for standard Python YAML libraries like PyYAML to preserve the original literal block format (e.g., | or >) when you load a YAML file and then dump it back. This is because the parser converts the literal block content into a standard Python string, discarding the original formatting. When you dump the string back to YAML, the dumper uses its own rules to represent the string, which typically defaults to a quoted style or a folded block style, but not necessarily the original one.