git-workflows

Guides Git branching strategies, conflict resolution, and history cleanup workflows.

1|Updated Aug 21, 2023
One-click install
npx skills add https://github.com/jmuchovej/homelab --skill git-workflows-jmuchovej
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-workflows
Source: https://github.com/jmuchovej/homelab/tree/main/src/modules/ai-tools/skills/git-workflows
Command: npx skills add https://github.com/jmuchovej/homelab --skill git-workflows-jmuchovej

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Managing Git branches, resolving merge conflicts, and keeping commit history clean are common sources of errors and lost work for developers. This Skill provides structured guidance on branching strategies, safe undo operations, and conflict resolution so teams can follow consistent version control conventions. ## Core Features & Use Cases - Branching Strategies: Covers Feature Branch and Trunk-Based workflows with naming conventions like feat/, fix/, and refactor/. - Conflict Resolution: Step-by-step workflows for resolving merge and rebase conflicts, including strategies for different conflict types. - History Cleanup: Fixup and autosquash workflows to fold follow-up fixes into original commits for atomic, reviewable history. - Use Case: A developer discovers a bug in a commit made three commits ago. Using the fixup workflow, they create a fixup commit targeting the original change and run an autosquash rebase to fold it in, keeping the history clean before opening a pull request. ## Quick Start Ask the assistant to walk you through resolving a merge conflict in your current branch or to clean up your recent commits using fixup and autosquash before opening a pull request.

Frequently Asked Questions about git-workflows

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I resolve a Git merge conflict?

Run git status to see conflicting files, then open each file and edit the conflict markers to keep the current version, the incoming version, or a combination of both. Stage the resolved files with git add, then continue with git rebase --continue, git merge --continue, or git commit depending on the operation.

When should I use git rebase vs git merge?

Use git rebase main to update a feature branch with the latest changes, keeping history linear. Use git merge when integrating a feature into main or working on collaborative branches where preserving history matters. Quick one-off fixes can go directly to main.

How do I fix a commit that is not the most recent one?

Stage the fix and run git commit --fixup=<target-commit-hash>, then run GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <oldest-target-hash>^. This folds the fix into the original commit, keeping history atomic without standalone fixup commits.

How do I recover a deleted Git branch or lost commits?

Use git reflog to view the history of HEAD changes and find the commit hash before the loss. Restore with git reset --hard HEAD@{n} or recreate a deleted branch with git checkout -b recovered-branch HEAD@{n}.

Is it safe to force push to a shared branch?

Force pushing overwrites remote history and can cause others to lose work, so never force push to main or master. If you must rewrite a pushed branch, use git push --force-with-lease and confirm with your team that no one else is using the branch.

When should I not use fixup and autosquash?

Avoid it when commits are already shared and team policy forbids rewriting history, or when the fix is genuinely new work that deserves its own commit. It is designed for folding follow-up fixes into the commits they belong to.