Thank you. I have accomplished my goal successfully. Following is what
I did:

Again, I have all my work I did. It is located in the directory
"mine/" and I use git to version control all my work. I received the
work files from my partner. He does not use any version control. He
sent me his tar files. Both he amd me are working on the same files. I
un-tar my partner's tar files into the directory "partner/", which is
parralel with "mine/".

cd partner
git init //create an empty git version control repository
git add xxx //adding the files into repository
git commit -a -m "received files from my partner. He has finished his

//Now, I want to merge my work(my commits inside mine/, one by one) to
my partner's work
//still at the same location as above
git remote add my_work ../mine
git fetch my_work  //fetch all my commits into the remote branch
git branch -a //"-a" shows all branches
//shows the following:
* master
git branch -r //"-r" shows remote branche
//shows the following:

Now, I can use "git cherry-pick" to pluck out my commits one by one:
cd ../mine  //change to mine/
git log  //shows all my commits and their corresponding SHA, actually
I output the log into a text file so that I can refer to later
cd ../partner
git cherry-pick my_first_commit_sha
//if no conflict, my first commit in mine/ directory is merged into my
partner's work and is committed already!!!
//if there is conflict, then:
git status .  //found out which file(s) were affected by the cherry-
pick merge and which of them are in conflict, then use file editor to
open the files in conflict and edit them, then check them in
git commit -a -m "merged from my first commit; solved the conflicts"

Another way is just merging my commit into my partner's files to
become local changes for me to view, before I commit the merged
results into repository is git format-patch method, which works for me
in one scenario, fails in another scenario. I don't know why:
//at partner directory
git format-patch -1 my_first_commit_sha //"-1" is "minus one", not
"minus little"; the command generates a patch file
xxx-xxx-xaskada-adafja.patch //patch file generated
git apply xxx-xxx-xaskada-adafja.patch

//Now, my commit in mine/ has become the local changes in partner/.
Again, if no conflict, then it is ready for commit; if there is
conflicts, need to solve the conflict first, then commit

I have to say, comparing to subversion, git indeed has some
advantages(e.g. everything, including the repository, is inside my
local directory, so no network to the central repository is needed, so
all the commands are fast). For subversion, commit and update commands
are talking with the central repository through the network. When the
project is big, the commands are slow.

However, most--i intend to say all-- git tutotials are half-baked,
including some well-cited tutorials. It seems nobody has the patience
to write it down and show other people and just let other people--like
me-- to struggle and find their way out.

On Oct 14, 8:02 pm, Wes Freeman <> wrote:
> I might be wrong, so be careful (you should make a copy of both repos
> before you start, just in case), but I think something like this might
> work:
> 1. Add your repository as a remote to the new repository.
> 2. Pull your changes in to the new repository.
> 3. From the new repository, git cherry-pick each commit.
> Wes
> On Fri, Oct 14, 2011 at 3:44 PM, www <> wrote:
> > Dear All:
> > I am new to git and I am using linux.
> > I am working on my project, using git and I have made about 20
> > commits. All my files are at the directory mine/ Inside mine, there
> > is .git directory. Now, I received the tar files from my partner. He
> > just finished his part of work and we are working on the same set of
> > files. He does not use version control. I put all his files in the
> > parallel directory his/. I did the following:
> > cd his
> > git init
> > git add xxxx  //all the stuff
> > git commit . -m "received from partner and he has finished his part"
> > Ideally, I want to step by step merge my revision one, my revision
> > two, my revision three, etc  from mine/ into his/
> > It is very likely that there will be conflicts since we are touching
> > same files. So I want to do merging step by step. I hope to view each
> > revision modification before committing.
> > How can I do it? I have googled and studied the whole day and my brain
> > hurts.
> > Thank you very, very much.
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Git for human beings" group.
> > To post to this group, send email to
> > To unsubscribe from this group, send email to 
> >
> > For more options, visit this group 
> > at

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to