I have a master
and dev
branches. Whenever I merge dev
into master
I have to use the --no-ff
(no fast-forward) method. What I do at the moment, after merging:
- delete
dev
- start a new
dev
branch frommaster
This allows me to continue the development on dev
after the merge. Is there a smarter/shorter way to do it?
Edit:
Simply continuing to commit to dev
and merge to master
yields the following graph:
git log --oneline --graph --branches
* 62d400f Second Merge branch 'dev'
|\
| * 86cd761 Continue 2 dev after merge
| * b10e96b Continue dev after merge
* | 04dcd00 Merge branch 'dev'
|\ \
| |/
| * 80d5577 Continue dev
| * 7119020 Started to dev file
|/
* 05350a5 Updated the file
* 9e70af0 Initial commit
However, if I delete dev
and then branch again from master
, I can have the following graph:
* c39c881 Third Merge branch 'dev'
|\
| * cab5dc5 Back on (new) dev
|/
* 62d400f Second Merge branch 'dev'
|\
| * 86cd761 Continue 2 dev after merge
| * b10e96b Continue dev after merge
* | 04dcd00 Merge branch 'dev'
|\ \
| |/
| * 80d5577 Continue dev
| * 7119020 Started to dev file
|/
* 05350a5 Updated the file
* 9e70af0 Initial commit
Correct me if I'm wrong, but this looks cleaner, isn't it? That's why I, naively, delete and re-branch from master
.
As for why I have this approach in the first place: my master
is basically an SVN where I'm allowed only certain commit messages (and thus limited number of commits). So I develop on dev
and when I'm ready I merge to master and leave the proper commit message.
Context:
I use the workflow described in this answer. I somehow realized that I have to delete dev
and re-branch from master
after I push the changes to SVN.