Skip to main content

30 posts tagged with "git"

git tag description

View All Tags

Conventional Commits Cheat Sheet & Guide

路 6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

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).

Format Summary

Standard Conventional Commit structure:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Primary types: feat (minor version bump), fix (patch bump), docs, style, refactor, perf, test, build, ci, chore. Breaking changes include ! before the colon or BREAKING CHANGE: in the footer (major version bump).

How to Fix the 'ModuleNotFoundError: No module named pre_commit' Error

路 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Getting the ModuleNotFoundError: No module named 'pre_commit' error is a classic "Lost in Translation" moment between your terminal and your Python environment. You know you want to commit code, and Git knows it needs to run a hook, but the Python interpreter looking for the pre_commit package is coming up empty-handed.

Here is the straightforward guide to finding that missing module and getting your hooks back on track.

Git Merging: How to Resolve Conflicts, Choose Strategies, and Keep Clean History

路 11 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

The dreaded CONFLICT (content): Merge conflict in file.txt. For many developers, seeing this message triggers an immediate spike in heart rate. It feels like you broke something.

Take a deep breath. You didn't break anything. A merge conflict is simply Git throwing its hands up and saying, "Hey, two people changed the exact same line of code, and I am not smart enough to guess which one is right. I need a human."

Here is how to read the Matrix, resolve the conflict, and get on with your day without losing your mind.

30-Second Conflict Resolution
  1. Identify conflicted files: git status
  2. Open the file and read markers:
    • <<<<<<< HEAD : Your current branch's version
    • ======= : Divider
    • >>>>>>> <branch> : Incoming version
  3. Resolve: Keep desired lines, delete all marker lines (<<<<<<<, =======, >>>>>>>).
  4. Finalize: git add <file> then git commit (or git merge --continue).

Git Fetch vs Git Fetch Origin: Differences and Upstream Tracking

路 6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

When you are typing away in your terminal, git fetch and git fetch origin probably feel exactly the same. In fact, if you only ever work on standard, single-team projects, you might go your entire career without realizing there is a difference at all.

However, Git is highly configurable. The moment you step into open-source development or complex team architectures, that little missing word (origin) suddenly completely changes how Git behaves.

Here is the candid truth about what Git is actually doing behind the scenes.

Core Difference
CommandBehaviorWhen to Use
git fetchDynamic: inspects current branch's upstream remote in .git/config and fetches from that remote.Day-to-day workflow tracking assigned remotes.
git fetch originHardcoded: fetches from the remote explicitly named origin regardless of active branch.Open-source multi-remote setups (e.g. origin vs upstream).

How to Find a Bug with `git bisect` (Binary Search Debugging)

路 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Finding a bug is like detective work-except the crime scene is your code, and the suspect is one of your last 200 commits. You know the code worked last week, and you know it's broken now, but finding the exact moment it failed can take hours of manual checking.

Enter git bisect. It uses a binary search algorithm to find the offending commit with mathematical efficiency. Instead of checking every commit, it cuts the search area in half every single time.

Use `git worktree` for Hotfixes: A Better Alternative to Stash

路 6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

We have all been there: you are deep in the zone, half-way through building a complex new feature, and your terminal is full of uncommitted changes. Suddenly, you get a message from your team: "Critical bug in production! We need a hotfix right now!"

The traditional response is to use git stash, switch to main, fix the bug, and then try to un-stash your messy feature branch later. But if you have complex dependencies (like node_modules or .venv) or untracked files, stashing can lead to absolute chaos.

This is where git worktree comes in. It is the professional's secret weapon for parallel development.

How to Fix 'fatal: cannot delete branch used by worktree' in Git

路 6 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Git provides safeguards to protect your active code branches from accidental deletion. When you try to delete a branch and receive the error: fatal: cannot delete branch 'xyz' used by worktree at '/path/to/folder', Git is warning you that the branch is currently checked out and actively linked to another working directory on your machine.

Here is why this error occurs, how to resolve it using three different methods, and how to use the listing commands to manage your workspace.

Quick Answer

Git blocks deleting a branch if it is actively checked out in a linked worktree folder. To resolve:

  1. Locate the worktree path: git worktree list
  2. Remove the link: git worktree remove <path> (or git worktree prune if deleted from filesystem)
  3. Delete the branch: git branch -d <branch-name>

How to sign your commits with a GPG key so that "Verified" badge appears next to your name on GitHub?

路 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

That "Verified" badge on GitHub isn't just for show-it's a cryptographic guarantee that the code actually came from you and hasn't been tampered with. Without it, anyone can technically spoof your name and email in a Git commit.

By using GPG (GNU Privacy Guard), you "seal" your commits with a private key that only you possess. GitHub then uses your public key to verify that seal.

Why Git Says 'No Existing Author Found' and How to Fix It

路 5 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

This error usually pops up when you're trying to use the --author flag during a commit or a rebase, and Git is failing its "detective work."

Unlike a simple text label, the --author flag triggers a search. Git tries to find a match in your existing history or your configuration. If your search string is too vague, has a typo, or doesn't match the required pattern, Git throws its hands up and says: fatal: No existing author found with 'XYZ'.

Git Commit Authors: How to Find, Change, and Configure Commit Identities

路 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Every Git commit records two distinct identities: the Author (who originally wrote the code) and the Committer (who applied the changes to the branch). While these are usually the same person, they can diverge during operations like rebasing, cherry-picking, or merging.

Whether you need to trace who wrote a line of code or fix a typo in your own commit email, this guide covers how to find, change, and automatically configure Git commit author details.