Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
git-merge-resolve65 linesDownload Raw Back to git-core
1#!/bin/sh2#3# Copyright (c) 2005 Linus Torvalds4# Copyright (c) 2005 Junio C Hamano5#6# Resolve two trees, using enhanced multi-base read-tree.7 8. git-sh-setup9 10# Abort if index does not match HEAD11if ! git diff-index --quiet --cached HEAD --12then13    gettextln "Error: Your local changes to the following files would be overwritten by merge"14    git diff-index --cached --name-only HEAD -- | sed -e 's/^/    /'15    exit 216fi17 18# The first parameters up to -- are merge bases; the rest are heads.19bases= head= remotes= sep_seen=20for arg21do22	case ",$sep_seen,$head,$arg," in23	*,--,)24		sep_seen=yes25		;;26	,yes,,*)27		head=$arg28		;;29	,yes,*)30		remotes="$remotes$arg "31		;;32	*)33		bases="$bases$arg "34		;;35	esac36done37 38# Give up if we are given two or more remotes -- not handling octopus.39case "$remotes" in40?*' '?*)41	exit 2 ;;42esac43 44# Give up if this is a baseless merge.45if test '' = "$bases"46then47	exit 248fi49 50git update-index -q --refresh51git read-tree -u -m --aggressive $bases $head $remotes || exit 252echo "Trying simple merge."53if result_tree=$(git write-tree 2>/dev/null)54then55	exit 056else57	echo "Simple merge failed, trying Automatic merge."58	if git merge-index -o git-merge-one-file -a59	then60		exit 061	else62		exit 163	fi64fi65 
codekingpro/portable-devtools · Team Ai