Working with two repositories in git

Me and my friend are working with some little project and we have problems with Git.
We have one main repository which is created by me. My friend forked it and cloned it to his local machine.

Now when I make some changes I push commits to my repository by doing:

  • How can I use my Git at school
  • reverting to previous change in bitbucket
  • How do I configure Git in Xcode to work with BitBucket
  • SSH KEY Already Exists Bitbucket
  • how do i search bitbucket files that contain a string and are contained in specific repos?
  • git clone command is not working?
  • git add -u
    git commit -m "message"
    git push origin master

    I’m getting changes from repository by git pull command.

    My friend is commiting changes by executing commands:

    git add -u
    git commit -m "message"
    git push origin master

    and he is getting changes from repo by git pull upstream master command.

    After we do it we have problem with synchronizing our repositories. When my friend creates Pull Request it says there are conflicts… and it happens each time we push commits.

    How to make it work that if my friend do some changes and create Pull Request, git will automatically add his lines of code without any conflicts to my repo?

  • Dynamically Fill Jenkins Choice Parameter With Git Branches In a Specified Repo
  • How can I get the diff between all the commits that occurred between two dates with Git?
  • Git is doing very slow commits on a Samba share. What can I do to speed it up?
  • first time pushing to github
  • GitHub include from another repository
  • Git - Get file blob by tree location not by sha
  • One Solution collect form web for “Working with two repositories in git”

    Well, if you change the same line of code, obviously you’ll have conflicts – that’s normal and that’s what you want to happen. You wouldn’t merge code you haven’t tested.

    So, before doing a Pull Request, any person sending it should pull (basically: pull = fetch + merge) the lastest changes from your repository, resolve conflicts and make sure its version is up to date.

    Then, if you push new commits to your repository before accepting the PR, the PR will be out of date and can’t be automatically merged. So, you can either pull your friends branch on your own workplace and resolve the conflicts – or you have your friends pull your master branch again and etc.

    When working closely with someone though, I always prefer to give writing permission to my colleague; so he can push as he want.

    The only thing really important to understand here is that before merging any branch on another, the branch must be up to date (pull and conflicts resolved).

    Git Baby is a git and github fan, let's start git clone.