nupac
nupac

Reputation: 2489

Git merge 2 versions

So I have a project on which me and another guy, are doing our thing. We are using 'git' for version control. Now, he has his own branch "version2" and I have my branch "version 1". We both have committed and pushed our versions to the repo but now how do we merge our projects together?

What I did was pulled his version on my system using git clone https:url.git -b version2 in a new directory. Then I tried to checkout to my branch(version1) and merge version2 to it but it said nothing to commit (working directory clean).

Then I tried git pull https:url.git but I got Automatic merge failed; fix conflicts and then commit the result.

So this is what I am trying to do. David and Alice pull from origin, do their thing and now to continue both their work they need to synchronise their versions.

Upvotes: 0

Views: 126

Answers (1)

Adrian Krupa
Adrian Krupa

Reputation: 1937

Dont' clone. This creates new repo instance. Checkout remote branch.

git checkout -b version2 origin/version2

Then switch back to your branch

git checkout version1

Finally you can merge version2 branch into version1 branch

git merge version2

Merge will be successful if there is no conflicts. At last push your changes to repo.

There is great book about git for begginers http://git-scm.com/book/en/

Upvotes: 1

Related Questions