Pulling changes from master to my work branch?

There’s two of us working on something. We’re using this branch structure

  • master
  • dev-A
  • dev-B

We both work on separate branches (dev-A,B) and whenever we’re done – we promote our changes to master.

But the drawback of this is we can’t get changes the other developer makes. Everything exists in the master tree – but we can’t get the latest updates the other developer made.

Is there a way to resolve this or should we change our branch structure (per feature?)?

0

I’ve seen developer branches used in two main scenarios:

  1. The open-source community, where these branches are actually repository forks, so that project maintainers can lock down access to the master repository and require integration through pull requests. This makes life more difficult for contributors, but much easier for the maintainers, which of course is exactly the point, and this is a very successful model on GitHub.

  2. Teams and organizations which do not have continuous integration and a track record of instability in their deployments, or worse, instability in their builds. These teams generally try to use developer branches as a way to protect the stability of the mainline, and the result is – typically – a long and very painful merge period before the release, followed by an even longer and more painful stabilization period, which sometimes doesn’t happen until after the release.

I don’t want this to be a rant about why you need CI, but it’s clear from your question that you know you aren’t integrating your changes often enough, so IMO there’s no point in dancing around the issue.

Unless you’re actually working in a geographically distributed team with a need to “gate” changes from outside developers, the branch-per-developer model really doesn’t make much sense. It especially doesn’t make sense with git, because every developer already technically has his/her own repository. Most organizations should be integrating very frequently – as in, several times per day.

I’m currently part of a group of about 35 contributors divided into 4 separate teams, most people check in at least 2-3 times a day, some people 10-15 times; it’s unusual to see builds broken and extremely rare for them to stay broken for more than a few minutes. Git handles merges so effortlessly most of the time that remote developer branches are just unnecessary overhead. Just pull, merge locally, and run commit tests before you push, it’s simple.

If you absolutely must defer integration in order to protect the stability of the master branch, the typical, proven model is to use an unstable branch – sometimes called a development branch, as described in A successful Git branching model. If developers can’t successfully merge into this branch (which only needs to build, not run flawlessly) at least once a day, then you have a quality/discipline problem and not a revision control problem; covering it up by using non-integrated developer branches only defers the problem, and by doing so, actually makes the eventual merges a lot more painful and unstable than they really need to be.

Feature branches aren’t the worst, but IMO very few projects are actually big enough to warrant them; if your project is very large (i.e. tons of features being worked on at once) then you’ll see better results from splitting it up into separate autonomous components than you will from papering over the problem with source control.

You can ignore this advice if you want, and many teams do, but one of the reasons the branching model linked above is so popular and successful is that it’s designed to work with continuous integration, not against it.

1

In your working branch if you go:

git commit -am "Committing changes before merge"
git merge master

you can also merge from the other developers branch

git checkout dev-A
git merge dev-B

What that will do is merge the changes in master to your development branch.

3

If dev-A and dev-B are different branches for different project then what @scaryrawr answered would be best.

But if dev-A and dev-B is actually precisely the same code (same project) then an alternative would be that both work on one of the branches. For example you create a branch off master called ‘devWork’. You both checkout devWork, work on it, commit and push changes. Pushed changes would not be on Master but in devWork, then the other users of the branch simply need to do a PULL locally to get pushed changes.

You could then follow standard methods to get work done on devWork back to Master etc.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật