Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am improving my friend's LaTeX document at folder 1/2, while he is editing the folder 1/1.

The initial contents of the folders is the same.

How can you meld the two folders to one such that all files are melded?

share|improve this question

3 Answers 3

up vote 9 down vote accepted

You're wanting to find the differences in files in two folders and merge the changes?

If you're looking for a GUI utility you can use FileMerge which can be found at /Developer/Applications/Utilities/ if you have Apple's Developer Tools installed. It has some odd bugs - mostly to deal with handling file encoding.

If you're looking for something faster and nicer check out Changes.app - it's not cheap but has been worth the price of admission several times over for me.

If you want to do it via the command line you can use diff to find the differences and then manually merge the files together as it will list all the differences. (eg. diff ~/Desktop/a ~/Desktop/b)

share|improve this answer

Since the mac is running a version of unix, you can use all of the tried, tested and true commands from the established UNIX heritage.

UNIX Shell Comparison of Directories Tutorial

share|improve this answer

The following code is made by Git-community

#!/bin/sh
#
# Filemerge.app must not already be open before running
# this script, or opendiff below will return immediately,
# and the TMPDIRs deleted before it gets the chance to read
# them.

[ \$# -eq 7 ] && opendiff "\$2" "\$5"
EOF
chmod +x merge.sh
GIT_EXTERNAL_DIFF=./merge.sh git-diff 


if test $# = 0; then
   OLD=`git-write-tree`
elif test "$1" = --cached; then
   OLD=HEAD
   NEW=`git-write-tree`
   shift
fi
if test $# -gt 0; then
   OLD="$1"; shift
fi
test $# -gt 0 && test -z "$CACHED" && NEW="$1"

TMPDIR1=`mktemp -d`
git-archive --format=tar $OLD | (cd $TMPDIR1; tar xf -)
if test -z "$NEW"; then
   TMPDIR2=$(git rev-parse --show-cdup)
   test -z "$cdup" && TMPDIR2=.
else
   TMPDIR2=`mktemp -d`
   git-archive --format=tar $NEW | (cd $TMPDIR2; tar xf -)
fi

opendiff $TMPDIR1 $TMPDIR2 | cat
rm -rf $TMPDIR1
test ! -z "$NEW" && rm -rf $TMPDIR2

You can then run

opendiff folder1 folder2

to achieve what I want.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.