I run the project with git flow, but when I merge the hotfix branch, I am concerned that the graph of the develop branch gets dirty.
At the bottom of the sample, I will write the log that was actually displayed, but I felt that the following points were dirty (although clean and dirty are also sensuous).
Since the hotfix was cut off from the master, I think the merge commit that existed only on the master side was taken in, but if anyone knows any countermeasures, please let me know.
# Also, it will be clean if you set git rebase master
for the develop branch before turning off hotfix.However, git push-f
is required, so I don't really want to use it.
# Initial Configuration
git flow init
echo a1>>a.txt
git add.
git commit-m "Initial commit"
# Feature branch adds functionality
git flow feature start dummy
echo a2>>a.txt
git add.
git commit-m "Add feature"
git flow feature finish dummy
# Released as Version 0.1
git flow release start 0.1
echo changelog > > changelog
git add.
git commit-m "Add changelog"
git flow release finish 0.1
# long-term development
for i in `seq1100`;do
echo dummy$i>>a.txt
git add.
git commit-m "Add dummy$i"
done
# Released as Version 1.0
git flow release start 1.0
echo changelog > > changelog
git add.
git commit-m "Add changelog"
git flow release finish 1.0
# Both develop and master are displayed beautifully at this point.
git log --graph-n20 --pretty=format: '%C(yellow)%h%C(cyan)%d%Creset%s%C(green)-%an,%cr%Creset' develop
# *8466a19(HEAD, develop) Merge branch'release/1.0' into develop - Yo Takezawa, 8 seconds ago
# |\
# | * 23f5fa4 (tag: 1.0) Add changelog - Yo Takezawa, 18 seconds ago
# |/
# * 3559 cae Add dummy 100 - Yo Takezawa, 3 minutes ago
# * a982 cbe Add dummy 99 - Yo Takezawa, 3 minutes ago
# * 4c12071 Add dummy 98 - Yo Takezawa, 3 minutes ago
# ...
git log --graph-n20 --pretty=format: '%C(yellow)%h%C(cyan)%d%Creset%s%C(green)-%an,%cr%Creset'master
# *91da8aa(master) Merge branch 'release/1.0' - Yo Takezawa, 42 seconds ago
# |\
# | * 23f5fa4 (tag: 1.0) Add changelog - Yo Takezawa, 47 seconds ago
# | * 3559 cae Add dummy 100 - Yo Takezawa, 3 minutes ago
# | * a982 cbe Add dummy 99 - Yo Takezawa, 3 minutes ago
# | * 4c12071 Add dummy 98 - Yo Takezawa, 3 minutes ago
# ...
# Fixed with hotfix as a bug was found
git flow hotfix start 1.1
echo hotfix > > hotfix
git add.
git commit-m "Add hotfix"
git flow hotfix finish 1.1
# The master side is clean.
git log --graph-n20 --pretty=format: '%C(yellow)%h%C(cyan)%d%Creset%s%C(green)-%an,%cr%Creset'master
# *7778437(HEAD, master) Merge branch 'hotfix/1.1' - Yo Takezawa, 36 minutes ago
# |\
# | * b07b7f5 (tag: 1.1) Add hotfix - Yo Takezawa, 36 minutes ago
# |/
# *91da8aa(develop) Merge branch 'release/1.0' - Yo Takezawa, 37 minutes ago
# |\
# | * 23f5fa4 (tag: 1.0) Add changelog - Yo Takezawa, 37 minutes ago
# | * 3559 cae Add dummy 100 - Yo Takezawa, 39 minutes ago
# | * a982 cbe Add dummy 99 - Yo Takezawa, 39 minutes ago
# suddenly get dirty on the develop side
git log --graph-n20 --pretty=format: '%C(yellow)%h%C(cyan)%d%Creset%s%C(green)-%an,%cr%Creset' develop
# * d293380(HEAD, develop) Merge branch'hotfix/1.1' into develop - Yo Takezawa, 12 minutes ago
# |\
# | * b07b7f5 (tag: 1.1) Add hotfix - Yo Takezawa, 12 minutes ago
# | *91da8aa Merge branch 'release/1.0' - Yo Takezawa, 13 minutes ago
# | |\
# |*\461e790 Merge branch 'release/0.1' - Yo Takezawa, 18 minutes ago
# | |\ \
# * | \\8466a19 Merge branch'release/1.0' into develop - Yo Takezawa, 13 minutes ago
# |\ \ \ \
# | | |_|/
# | |/| |
# | * | 23f5fa4 (tag: 1.0) Add changelog - Yo Takezawa, 13 minutes ago
# |/ / /
# * | | 3559 cae Add dummy 100 - Yo Takezawa, 16 minutes ago
# * | | a982 cbe Add dummy 99 - Yo Takezawa, 16 minutes ago
# * | | 4c12071 Add dummy 98 - Yo Takezawa, 16 minutes ago
I think it's better to accept that git's restriction makes its history chaotic. Git is managed by git, but its history management flow is more acrobatic than git flow, and I think it's probably originally supposed to be "You can write a script that extracts information by following a commit graph if necessary!"
However, there are always requests to keep history clean, so recently github has come to have functions such as squash and rebase when accepting PR.However, I think this is because there is an assumption (assuming) that the github flow always has one master.
With the supposed git flow of maintaining the master/development two things, I think history will get dirty (or complicated).
© 2024 OneMinuteCode. All rights reserved.