2016-03-08 159 views
1

我一直在處理一個項目,其中所有提交的消息都是用西班牙語製作的。現在我正在和其他國家的人一起工作,所以我想將提交信息更改爲英文。可能嗎?將消息更改爲已提交的提交

回答

2

是的,你將不得不做什麼被稱爲「互動式基地」。這將允許您除其他外重寫提交消息。

使用git log --topo-order --reverse找到第一個提交ID(它將是第一個),然後使用git rebase -i來重寫所有提交消息。它看起來像這樣。

$ git rebase -i <first commit ID> 

pick ea21ffd Version 2.13.1 
pick b98b956 Allow the extra_compiler_flags option to work. 
pick d096ee5 Fix "perl5i -e" from segfaulting. 
... 

# Rebase 42c49b0..d096ee5 onto 42c49b0 (3 command(s)) 
# 
# Commands: 
# p, pick = use commit 
# r, reword = use commit, but edit the commit message 
# e, edit = use commit, but stop for amending 
# s, squash = use commit, but meld into previous commit 
# f, fixup = like "squash", but discard this commit's log message 
# x, exec = run command (the rest of the line) using shell 
# d, drop = remove commit 
# 
# These lines can be re-ordered; they are executed from top to bottom. 

在你的情況,你會改變每pickreword

請參閱Pro Git中的Changing Multiple Commit Messages以獲取有關執行交互式資源重置的更多信息。

注意,這樣做你不改寫歷史,你創造新的歷史記錄。所有的提交ID都會改變。任何有簽出代碼的人都會在嘗試推送和重新同步時遇到錯誤。請參閱Pro Git書中的The Perils Of Rebasing以獲取更多信息。