1

I am using sourcetree for code repository in bitbucket.
I want to understand how does other team uses sourcetree and repo branching.

Is it done branch per dev or multiple devs per branch, and if so does any conflict occur in case multiple people from their local repo push to the remote repo?

We are a small team so, we have created individual branches, and everyone pushes into their own branch and finally is merged into master.
I think the above process is wrong as because when the team size scales up, it is not possible to create individual branches.

kowsky
  • 12,647
  • 2
  • 28
  • 41
Nitish Patra
  • 289
  • 5
  • 20

1 Answers1

4

The branches are generally organized around features, not individuals: what if an individual is leaving: what are you supposed to do with his or her branch?
As opposed to a feature branch, which represents a goal to implement.

Several people can collaborate to a common branch, rebasing their local commits on top of the updated fetched feature branch, and then pushing their commits: any conflicts is resolved locally first (during the rebase).

Now X is also working on branch A, now he gets the pull request on A done by Y.

X does not get pull request.
what X done is a simple git pull. If git is properly configured (meaning pull.rebase and rebase.autostash are set globally), that git pull triggers a rebase of any local commits on branch A on top of the fetched updated origin/A.

So what should X do now assuming there is no conflict?

A git push, to push his/her own commits to the remote repo, in branch A.

And after X does his part, does Y gets any pull request for the rebase?
No. Y will pull in his/her own time that same branch.

The general idea is: when working collaboratively on a common branch, pull first (and resolve any conflict locally), then push when ready.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • So, lets say we have 2 people X and Y working on branch A. Lets say Y commits some changes into local repo and then into remote. Now X is also working on branch A, now he gets the pull request on A done by Y. So what should X do now assuming there is no conflict ? And after X does his part, does Y gets any pull request for the rebase? – Nitish Patra Dec 18 '18 at 06:54
  • @NitishPatra I have edited my answer to address your comment. – VonC Dec 18 '18 at 07:35
  • Hey, man Thank you very much. Surely it is helpful. Also, if you know any tutorials on the above please do mention. – Nitish Patra Dec 18 '18 at 08:15
  • @NitishPatra https://www.atlassian.com/git/tutorials/merging-vs-rebasing is a good read. – VonC Dec 18 '18 at 08:19