tags:

views:

55

answers:

4

Hello, I'm working under project (using github) with my friend. The situation:

  • My friend checkouted the sources
  • I made some changes and committed them
  • My friend worked with his copy and now he tries to commit them. The problem is that he can't do this.

The only way I see now is reseting his local copy, pull the newest changes and write back all the new code he wrote. How would it be?

+1  A: 

You can always commit, although you may not be able to push. It looks like in your case everyone needs to commit their changes and then someone needs to pull and resolve conflicts, if any.

Gintautas Miliauskas
+1  A: 

Your friend needs to pull the latest version of the source, apply his changes to it, and then he can push it into the git.

Rob S.
+4  A: 

you can always fetch from upstream and then merge your changes. git provides a convenience call for this: git pull, it will fetch and then merge. your friend should then be able to push again

knittl
Should use `git pull --rebase` for cleaner history.
mathepic
i wouldn't advise newbies to use history rewriting, it does more harm than good if you don't fully understand the implications
knittl
+1  A: 

your friend does not need to reset anything. git will try to automatically merge your changes into his changes when he does: git pull

if your changes conflict with his changes, git will tell him when he does his pull. after resolving any conflicts, your friend will be able to push his changes back to github.

James Talbot