کانفلیکت‌های گیت - مرجع کامل

نوع کانفلیکت سناریو / علت جزئیات
Cherry-pick Line Conflict When cherry-picking a commit from develop to stage, lines modified in both branches overlap, causing a conflict. Cherry-pick Line Conflict
Merge Line Conflict Two branches modify the same lines in the same file during a merge, resulting in conflict markers in the file. Merge Line Conflict
Rebase Commit Conflict Rebasing a branch onto another branch where overlapping changes exist, Git stops at conflicted commit. Rebase Commit Conflict
Binary File Conflict Both branches modified a binary file (e.g., image, Excel), Git cannot auto-merge. Binary File Conflict
Pull Conflict Due to Local Changes Local edits conflict with incoming remote changes when executing git pull. Pull Conflict Due to Local Changes
Delete vs Modify Conflict One branch deletes a file while the other modifies the same file. Delete vs Modify Conflict
Submodule Pointer Conflict Both branches update the same submodule to different commits. Submodule Pointer Conflict
File Rename Conflict Same file renamed differently on two branches; Git cannot auto-merge. File Rename Conflict
Line Ending Conflict (CRLF vs LF) Different OS users commit with different line endings, causing conflicts. Line Ending Conflict (CRLF vs LF)
Whitespace Conflict Whitespace differences in the same lines across branches. Whitespace Conflict
Subtree Merge Conflict Merging a repository subtree causes overlapping files or directories. Subtree Merge Conflict
Tag Conflict Both branches have a tag pointing to different commits. Tag Conflict
Stash Apply Conflict Applying a stash conflicts with current branch files. Stash Apply Conflict
Revert Commit Conflict Reverting a commit conflicts with subsequent changes. Revert Commit Conflict
Interactive Rebase Squash Conflict Squashing multiple commits with overlapping changes during interactive rebase. Interactive Rebase Squash Conflict
Fast-forward Merge Blocked Cannot fast-forward because branch histories diverged. Fast-forward Merge Blocked
Remote Upstream Change Conflict Remote branch changes conflict with local commits. Remote Upstream Change Conflict
Empty Commit Conflict Cherry-pick or rebase results in an empty commit because changes already exist. Empty Commit Conflict
Locked File Conflict File is open in another program or locked by OS; cannot apply changes. Locked File Conflict
Custom Merge Driver Conflict Custom merge driver cannot resolve conflicts automatically. Custom Merge Driver Conflict
Interactive Rebase Multi-Commit Conflict Squashing or reordering multiple commits with overlapping changes. Interactive Rebase Multi-Commit Conflict

نمونه عملی Cherry-pick

انتقال یک commit از develop به stage و رفع کانفلیکت

# رفتن به branch مقصد
git checkout stage

# پیدا کردن commit مورد نظر از develop
git log develop

# cherry-pick commit
git cherry-pick abc1234

# در صورت وجود conflict
git add .
git cherry-pick --continue

# لغو cherry-pick
git cherry-pick --abort