Tanky Woo
Tanky Woo

Reputation: 5106

Does a dev branch should be deleted after every merged and then create?

If there is a branch name dev, it is a normal develop branch.

Should I delete it after every merge and then create a new one?

If do not delete, the branch network is(all merge use --no-ff):

*   0019d6a - (HEAD, master) Merge branch 'dev' second (2 minutes ago)
|\
| * e6dcaf5 - (dev) add b.file (2 minutes ago)
* |   c39915b - Merge branch 'dev' (3 minutes ago)
|\ \
| |/
| * 352afa1 - add a.file (4 minutes ago)
|/
* d06fb93 - init (4 minutes ago)

The version c39915b is the first merge, and then go on develop, do the second merge.

If I delete and create a new one, it will start from version c39915b:

*   4a4b8dc - (HEAD, master) Merge branch 'dev' second (7 seconds ago)
|\
| * afd5dfe - (dev) add b.file (16 seconds ago)
|/
*   c39915b - Merge branch 'dev' (3 minutes ago)
|\
| * 352afa1 - add a.file (4 minutes ago)
|/
* d06fb93 - init (4 minutes ago)

In the second situation, the branch network in clear than the first one.

I don't know which one is better?


Append:

I read git-flow and find this picture:

git-flow

It use the first one and keep the dev branch as a long-term branch.

Upvotes: 0

Views: 89

Answers (1)

Akash
Akash

Reputation: 5221

In this scenario, the second method is just a lot more work over time with absolutely no benefit.

Stick with the branch and keep merging it. Moreover, you can get the second type history even if you stick with branch all the way. Whenever you make a change directly to master, merge it in dev (not dev in master, the other way round) to bring the dev branch up to date.

Upvotes: 1

Related Questions