-1

I want to get the idea on how to manage the Parent-Child Hierarchy in git. Let's say I have a master branch where code will be updated once a week. I have made a new branch say MainDev for development. When the team works, they create branches on their local like NewBranch. I have 2 questions:

  • How can I push the newly created branch only to MainDev so that, MainDev and all the pull requests I create, should be merged only on MainDev?
  • Is there any way that BitBucket automatically merges the MainDev branch to master and updates master and MainDev once a week?
Makoto
  • 104,088
  • 27
  • 192
  • 230
baig772
  • 3,404
  • 11
  • 48
  • 93
  • 1
    Relevant: [Git Flow](http://nvie.com/posts/a-successful-git-branching-model/), which describes in essence what you're accomplishing. – Makoto Jun 04 '16 at 15:14
  • Possible duplicate of [git flow branching model branching](http://stackoverflow.com/questions/10941466/git-flow-branching-model-branching) – Marcus Müller Jun 04 '16 at 15:19

1 Answers1

0

No automatic merge tools that I know of with BitBucket, but regarding PRs you may want to change your default branch through the repo's admin page.

Briana Swift
  • 1,047
  • 8
  • 9
  • regarding automatic merge, I can do that manually, but if I do `git push MainDev NewBranch`, this will push the code to only `MainDev` and branch will be created UNDER `MainDev`? – baig772 Jun 04 '16 at 15:30
  • If you want to push code to `MainDev` and create a new branch from `MainDev`, you should run `git push` while on `MainDev`, then `git branch NewBranch` to create new branch from `MainDev`. – Briana Swift Jun 04 '16 at 15:31
  • I am always on `MainDev`, should I do 1. git pull (on `MainDev`) 2. git branch `NewBranch.Num` 3. make changes 4. `git add -filenames` 5. `git push` on `MainDev` are the steps right for what I am trying to achieve? – baig772 Jun 04 '16 at 15:37
  • It depends on what you are trying to do. What are you trying to accomplish by syncing the local and remote repositories and creating a new branch? – Briana Swift Jun 04 '16 at 15:38
  • I'm still having trouble understanding what you're trying to achieve. Do you want to create a new branch locally from `MainDev`, make changes on that branch, and then push those changes on the new branch to the remote repository? (That's the suggested workflow for both Git and GitHub.) – Briana Swift Jun 04 '16 at 15:41
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/113814/discussion-between-baig772-and-briana-swift). – baig772 Jun 04 '16 at 15:42