Back

I prefer git merge to git rebase (喜欢merge)

发布时间: 2013-04-17 08:10:00

原因很简单, git merge 可以保留原始的commit 时间。 而rebase 会破坏这一点。( usually I prefer 'merge' than 'rebase')

比如,

branch2: 

f738cf3 added line 2 to file 2 on branch2 (Siwei, 6 seconds ago)
a2f47a2 added line 1 to file 2 on branch2 (Siwei, 87 seconds ago)
53f630f commit file2 on branch2 (Siwei, 3 minutes ago)
29c906c added file1 (Siwei, 4 minutes ago)

master:

5d4cff1 added line 2 to file 1 on master (Siwei, 58 seconds ago)
5ba53c5 added line 1 to file 1 on master (Siwei, 2 minutes ago)
29c906c added file1 (Siwei, 4 minutes ago)

after merge ( master to branch2)

256a762 Merge branch 'master' into branch2 (Siwei, 2 seconds ago)
f738cf3 added line 2 to file 2 on branch2 (Siwei, 57 seconds ago)
5d4cff1 added line 2 to file 1 on master (Siwei, 2 minutes ago)
a2f47a2 added line 1 to file 2 on branch2 (Siwei, 2 minutes ago)
5ba53c5 added line 1 to file 1 on master (Siwei, 3 minutes ago)
53f630f commit file2 on branch2 (Siwei, 3 minutes ago)
29c906c added file1 (Siwei, 5 minutes ago)

Back