6 printf $
"Usage: %s\n" "git merge-without-working REMOTE"
7 echo $
"It merges the commit REMOTE with your current branch, advancing it, without touching your working dir."
8 echo $
"It's useful for constructing the history (say, after an import from RCS) without loosing the current states of your files."
11 if [[ $# != 1 ]]; then
26 readonly BASE
="$(git merge-base HEAD "$REMOTE")" \
28 if [[ "$BASE" == "$(git rev-parse "$REMOTE")" ]]; then
29 echo $
"Nothing to do."
30 elif [[ "$BASE" == "$(git rev-parse HEAD)" ]]; then
32 git update-ref HEAD
"$(git rev-parse "$REMOTE")"
34 printf $
"Merging %s ethereally.\n" "$REMOTE"
35 git read-tree
-v -m -i "$BASE" HEAD
"$REMOTE"
36 # The commit message is read from stdin.
37 git commit-tree
"$(git write-tree)" -p HEAD
-p "$REMOTE" \
38 |
xargs git update-ref HEAD