tags:

views:

23

answers:

1

I have:

folder_a/app_1.0
folder_b/app_1.1

And let's just say I'm working off of the master branch in both folders/repos.

How can I merge the branches together?

+3  A: 

You must pull the commits from one repository into the other, do the merge, then pull back into the first (if you want both repositories to contain all the commits).

# switch to repo A
cd folder_a

# Add repo B as a remote repository
git remote add folderb /path/to/folder_b

# Pull B's master branch into a local branch named 'b'
git pull folderb master:b

# Merge b into A's master branch
git merge b

# Switch to repo B
cd ../folder_b

# Add repo A as a remote repository
git remote add foldera /path/to/folder_a

# Pull the resulting branch into repo B's master branch
git pull foldera master:master
Stephen Jennings
Since folder_b is not a bare repository, you shouldn't push into it. You should add folder_a as a remote and pull from it.
mkarasek
You're right, of course. I updated to reflect your suggestion.
Stephen Jennings