【问题标题】:Squashing commits with some commits pulled from origin使用从源中提取的一些提交来压缩提交
【发布时间】:2018-01-21 00:14:31
【问题描述】:

我处理了一些本地提交,将其他人所做的远程提交提取到我的本地分支,然后又进行了一些本地提交。我想我做到了。

问题是当我执行git -log 时会列出:

提交 1b6f7af1bdf21f397bab146fca11f74151b30e15 (HEAD -> bug_fixing, origin/bug_fixing) 作者:steve 日期:Wed Jan 17 18:23:17 2018 -0500

fix issued Play #30, #27, #26; GPL #240

提交 069646ced4300bb30d6fbe33fbebb8e504e55de6 合并:c215cbc3 23cf454b 作者:史蒂夫 日期:1 月 17 日星期三 2018年18:17:12 -0500

downloadThread to Executor

提交 c215cbc3751092b00573152db2ced2369672497a 作者:史蒂夫 日期:2018年1月17日星期三18:10:56 -0500

downloadThread to Executor

提交 4dffc55b667580b3103b6c5f1d9f17ad1d95c134 作者:史蒂夫 日期:2018年1月17日星期三18:10:42 -0500

downloadThread to Executor

提交 23cf454b4bf82fe9808259ac7cc76643d45869f8 (来源/播放, origin/HEAD) 作者:geecko 日期:Sun Jan 14 2018年01:05:57 +0100

Show ID3 lyrics in floating window only if no connectivity

我想将前四个提交压缩为一个。但是,当我执行 git rebase -i HEAD~4 时,我在编辑器中得到以下信息:

pick 4dffc55b downloadThread to Executor
pick c215cbc3 downloadThread to Executor
pick 60c385c6 Change error message when requesting lyrics while missing both fingerprint and artist/title. Also refresh lyrics after being granted storage permission
pick ded8bea7 Add User Poll
pick 04e9484c Don't use appsee if user has had the app for more than a day
pick 37468ce2 Auto cancel the translation & survey notifications
pick ead6b151 Remove useless conditions
pick 7988b0b5 Add test device (AdMob)
pick 70da81e0 Fix NPE in OverlayContentLayout
pick 15f05ce1 Refresh MediaStore every once in a while
pick 923d63e9 Bump versionCode
pick 635543d9 Show resync button for API versions < Kitkat
pick 9b8de33a Retain user input inside UserPollActivity after rotation
pick 23cf454b Show ID3 lyrics in floating window only if no connectivity
pick 1b6f7af1 fix issued Play #30, #27, #26; GPL #240

其中包括从远程提取的提交,我不知道该怎么做。如何仅压缩日志中列出的前四个提交?

【问题讨论】:

    标签: git github


    【解决方案1】:

    通常,如果您只想压缩日志中列出的前四个提交,您必须这样做:

    git reset --soft HEAD~4git commit -m "new message"

    【讨论】:

    • 这似乎覆盖了拉取提交的历史
    • 我可能还没明白。所以现在,你的 git 日志显示 A - download - download - download - B。在“修复”之后你期望什么 git log ? A - B ?还有一个问题:您有未分阶段的更改吗?
    猜你喜欢
    • 2022-07-21
    • 2022-01-07
    • 2018-06-01
    • 2015-07-20
    • 2021-03-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-08
    相关资源
    最近更新 更多