12
I’m trying to define a working scheme to keep my repository on Github organized, but it is difficult to reach a solution.
My "idea":
I thought about keeping the branch in the remote repository master (default) and develop. The branch master will be blocked, will only accept merge after review of pull-request, i.e., contributors will send their contributions to the develop and generate a pull request of this for master.
The Feature/foo, Hotfix/foo and other branches will be branched from the develop, I don’t know if it would be interesting to branch even more with branch topic. Before merging the local branch with develop, should be evaluated the need to apply a full rebase or some commit, aiming to maintain a clean and easy to read historical line, after local merge and push to remote, a pull-request from the master <- develop
.
In the text so it was already possible to observe some doubts, we will consolidate them and some more:
- In practice branch topic are really useful and used?
- Local rebase before push is a good idea, in which situation it would be advisable?
- It would be more advisable to change my CHANGELOG.Md file in the develop branch, or create a release branch, change there and then merge with
master
anddevelop
? - When merging a
master
<-develop
, should I use merge request (which takes all merge commit + 1), or merge squash (which generates only 1 output commit)? Because of your suggestion?
Due to the importance of the next topic, I decided to separate it from the previous ones:
When I will perform a pull-request master
<- develop
a conflict in will always occur, this is referring to the file CHANGELOG.Md, whereas new data is always entered at the top, git will always file a change for which an automatic merge cannot be executed. How to solve this problem?
Possible solutions:
- In the case of Github this suggests to merge the
develop
<-master
, resolve the conflict, apply the control commit, and complete pull-request/merge; - I create a release branch from
develop
, mergerelease\xxx
<-master
, resolve conflicts, apply proper commit, perform mergemaster
<-release\xxx
anddevelop
<-release\xxx
; - Or would you have another "better" approach? By best I mean community approaches to collaborative projects, which are proven to be but efficient.
Final doubts:
By following the wake of git flow, after creating the branch release, should merge this with the mater and develop, whereas my master is protected in Github (accepting merge only via pull request), should I upload this branch to the remote and generate the pull-request for the master? And to develop it, I merge locally and push?
Note: I believe that this doubt is part of the head of many people.
Tip: do not branch
hotfix
ofdevelop
. If it’s hot it’s in production, so it branches off themaster
. It may even be that the pull request is done by someone less experienced indevelop
, but trying to branch out from it is quite complicated. I treated something about branches and tags in a reply. More here– Jefferson Quesado
Gitflow does all this proce =)
– Francisco
I don’t understand why CHANGELOG.Md generates conflict because the data is at the top of the file
– Andre Figueiredo
https://danielkummer.github.io/git-flow-cheatsheet/index.pt_BR.html
– Andre Figueiredo
https://medium.com/trainingcenter/utilizando-o-fluxo-git-flow-e63d5e0d5e04
– Andre Figueiredo
@Andrefigueiredo
git checkout master && git merge release/v1.0.1
should still be merged with develop, correct? Another question, it does the local merge, this would be equivalent to me go to the master and do a pull (considering that the master is already updated)?– Fábio Jânio