Tutorial :Synchronizing repositories with Git



Question:

i and a friend are developing a web application and using Git for versioning. In the office we are using a model of a central repository and also, each developer has your personal repository. I and my friend are working from house now, and i have implemented features that my friend needs. How i can send a resume of my commits to my friend, in such way that he can be aware of my improvements? Detail: I'm with more commits than my friend and i don't know at what point ours branchs diverge


Solution:1

You have some kind of public repository, don't you? If not, run

git daemon  

Your friend can then pull your repository into a new branch, see what's changed and eventually merge:

git checkout -b lucas  git pull git://lucascomputer/  git checkout master  git diff lucas  git merge lucas  


Solution:2

You could do a git push to his repository. The syntax of git push is:

git push [remote-repository-reference] [remote-head-name]  

So assuming that the remote repository is named origin and the remote head name is master the command would be:

git push origin master  

Executing the above command does two things:

  • Add new commit objects sent by the pushing repository.
  • Set [remote-head-name] to point to the same commit that it points to on the pushing repository.

Hope this helps.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »