How to work with another person on the same branch in Git?

I am working on some features with my colleague. We created a thread theme. And everything is in order when we only combine everything - our branch on the server with local copies and a wizard to update our branch. But this is not an ideal workflow.

Can someone point me to a better solution?

+4
source share
3 answers

I think you want to work with your colleague without using the main repository as an average hand. I would add the repository of others as remote and create a branch that tracks its topic thread. Another person can then do the same, but set up his local thread as his upstream branch.

Sort of

  • git remote file add coworker: //// coorkersComputer / path / to / repo
  • git fetch employee
  • git checkout --track coorker / topic-branch

Here you can pull changes from your colleague. If you want to rebuild things, you can always create local branches and reinstall them on the topic branch.

Your colleague should set up your computer in the same way:

  • git remote file addRepo: //// ..
  • git fetch yourRepo
  • git branch --set-upstream-branch-branch yourRepo / topic-branch

The good thing is that you can work in complete isolation without causing any problems to other colleagues. You have already configured each other as remotes, so 1. you need only once. 2 and 3. is required only when you want to set up a new theme to work.

+3
source

This is how I love to do it. Each of you must work in your branch. When you integrate, check the main branch and pull from each of your branches (where you added, committed and pulled the corresponding changes that you want to receive).

A continuous integration server such as Integrity ( www.integrityapp.com ) should help.

+1
source

I assume that you are doing git pull from the server when you really need git fetch . The problem is that git pull automatically merges your local branch with the remote branch that it is tracking, but git fetch does not work.

The solution will use only git fetch , and then either git merge origin/master or git rebase origin/master (replace master with the actual branch name), depending on how you want the story to look.

0
source

All Articles