問題:
Coming from mercurial, I use branches to organize features. 來自mercurial,我使用分支來組織功能。 Naturally, I want to see this work-flow in my history as well. 當然,我也想在我的歷史中看到這種工作流程。
I started my new project using git and finished my first feature. 我使用git開始了我的新項目並完成了我的第一個功能。 When merging the feature, I realized git uses fast-forward, ie it applies my changes directly to the master branch if possible and forgets about my branch. 合併該功能時,我意識到git使用快進,即如果可能,它會將我的更改直接應用到主分支並忘記我的分支。
So to think into the future: I'm the only one working on this project. 因此,思考未來:我是唯一一個從事這個項目的人。 If I use git's default approach (fast-forward merging), my history would result in one giant master branch. 如果我使用git的默認方法(快進合併),我的歷史將導致一個巨大的主分支。 Nobody knows I used a separate branch for every feature, because in the end I'll have only that giant master branch. 沒有人知道我爲每個功能使用了一個單獨的分支,因爲最後我只有那個巨大的主分支。 Won't that look unprofessional? 這看起來不專業嗎?
By this reasoning, I don't want fast-forward merging and can't see why it is the default. 通過這種推理,我不想要快進合併,也不知道爲什麼它是默認的。 What's so good about it? 這有什麼好處的?
解決方案:
參考一: https://stackoom.com/question/BxVh參考二: Why does git perform fast-forward merges by default?