我最喜欢的git
工作流程是rebase
在提交master
之前的所有内容,还要使用git merge --no-ff
来创建具有可读性的历史记录,可识别的大块工作,以及这些工作中的细节。
使用--no-ff
会给出一个看起来像这样的历史记录:
|
|\
| \
| |FeatureA.InterestingStep1
| |FeatureA.InterestingStep2
| |FeatureA.InterestingStep3
| |FeatureA.InterestingStep4
| |FeatureA.InterestingStep5
| /
|/
|FeatureA
|\
| \
| |FeatureB.InterestingStep1
| |FeatureB.InterestingStep2
| |FeatureB.InterestingStep3
| /
|/
|FeatureB
这一切都很好。
令人遗憾的是,如果我试图改变这一点,那么我就失去了结构。
假设我已经完成了我的工作,获取,重新定位,清理了合并冲突,清理了我当地的杂乱提交历史记录,成为我想要掌握的(仍然是多个)最终提交并构建了必要的{{ 1}}结构。
然后我推,但团队中的其他人已经打败了我的拳头和起源\主人已经移动。
如果我重新定义,那么--no-ff
结构就会消失,我会留下一个线性提交序列。
重新创造它不是世界末日,但有没有办法在不丢失结构的情况下进行重组?
答案 0 :(得分:2)
你想要的是-p
的{{1}}(或--preserve-merges
)选项保留合并提交
来自doc:
重新创建合并提交,而不是通过重播来展平历史记录 提交合并提交介绍。合并冲突解决方案或 不保留对合并提交的手动修订。
答案 1 :(得分:1)
除了@Francesco 您可能还想留意许多开发人员使用的git pull --rebase。它也使历史变得平坦。避免这种情况的方法是手动进行fetch / rebase,即(在master上)
git rebase --preserve-merges origin/master
string EffectiveDate = string.Empty;
IList<Task<string>> list = new List<Task<string>>();
foreach (DataRow dr in rows)
{
var task = Task.Factory.StartNew(new Func<string>(() =>
{
string result = string.Empty;
string columnId;
try
{
var rates = GetMainRateModel(dr);
lock (_objMainRatesAsync)
{
long seq = _redis.Core.IncrementValue(_currUserKey);
columnId = dr["ColumnId"].GetString();
EffectiveDate = Convert.ToDateTime(dr["Validity date"]).ToString("yyyy-MM-dd");
if (rates != null)
{
foreach (var rate in rates)
{
var surCharges = GetContractSurchargeModel(rate, EffectiveDate);
rate.Surcharges = surCharges;
GetVATOSSurcharges(rate, surCharges, EffectiveDate, dr);
}
_redis.Hash_Set(_currRates, columnId, rates);
}
}
}
catch (Exception eex)
{
lock (_objProcessRateAsync)
{
_sbErrors.AppendLine(string.Format("Error, when the get data from web service. Detail message: {0}", eex.Message));
}
result = eex.Message;
}
return result;
}));
list.Add(task);
}
Task.WaitAll(list.ToArray());