第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

壓縮提交記錄

標(biāo)簽:
Git

运用场景

在没有推送本地修改到共用分支之前,可以通过变基操作整理提交历史。

执行步骤

执行 git log,列出所有的提交:

$ git checkout main
$ git log
commit ff3490694a2168a94abc0188fe35cdd102d3c7fc (HEAD -> main, origin/main, origin/iss53, iss53)
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Wed Feb 21 16:09:29 2024 +0800

    第二次修改iss53

commit b0a67cb1bbd16e8a812516dad50b129961f483f7 (iss52)
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Wed Feb 21 16:02:42 2024 +0800

    修改iss52

commit 9f5bfba20b0448961111fe1cc621187b461284c4
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Wed Feb 21 16:00:55 2024 +0800

    修改hotfix

commit ca5ebf0f7e0438c514b9039594e86b6bc1ef64e2
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Tue Jan 30 16:24:42 2024 +0800
:

通过给 git rebase 增加 --interactive ( 简写为 -i )选项来交互式地运行变基,可以将一连串提交压缩成一个单独的提交。

$ git rebase -i HEAD~3 # 也可以使用哈希值 git rebase -i ca5ebf0
pick 9f5bfba 修改hotfix
pick b0a67cb 修改iss52
pick ff34906 第二次修改iss53

# Rebase ca5ebf0..ff34906 onto ca5ebf0 (3 commands)
#
# Commands:
# p, pick <commit> = use commit
# r, reword <commit> = use commit, but edit the commit message
# e, edit <commit> = use commit, but stop for amending
# s, squash <commit> = use commit, but meld into previous commit
# f, fixup [-C | -c] <commit> = like "squash" but keep only the previous
#                    commit's log message, unless -C is used, in which case
#                    keep only this commit's message; -c is same as -C but
#                    opens the editor
# x, exec <command> = run command (the rest of the line) using shell
# b, break = stop here (continue rebase later with 'git rebase --continue')
# d, drop <commit> = remove commit
# l, label <label> = label current HEAD with a name
# t, reset <label> = reset HEAD to a label
# m, merge [-C <commit> | -c <commit>] <label> [# <oneline>]
"~/git-practise/.git/rebase-merge/git-rebase-todo" 34L, 1566B

如果想要这三次提交变为一个提交,可以这样修改上面的内容:

pick 9f5bfba 修改hotfix
squash b0a67cb 修改iss52 # 简写 s 也可以
squash ff34906 第二次修改iss53 # 简写 s 也可以

当保存并退出编辑器时,会展示出三次提交信息:

# This is a combination of 3 commits.
# This is the 1st commit message:

修改iss52

# This is the commit message #2:

修改iss53

# This is the commit message #3:

第二次修改iss53

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date:      Wed Feb 21 16:02:42 2024 +0800
#
# interactive rebase in progress; onto 9f5bfba
# Last commands done (3 commands done):
#    squash 3f9efe3 修改iss53
"~/git-practise/.git/COMMIT_EDITMSG" 28L, 669B

合并三次提交信息:

# This is a combination of 3 commits.
# This is the 1st commit message:

修改iss52、iss53

# This is the commit message #2:



# This is the commit message #3:

保存之后,再次执行 git log,三次提交变为一个提交。

$ git log
commit 877ae9ea21b69947dec3c2fce588c1da7e955ee6 (HEAD -> main)
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Wed Feb 21 16:00:55 2024 +0800

    修改iss52、iss53

commit ca5ebf0f7e0438c514b9039594e86b6bc1ef64e2
Author: zhanglianwei <zhanglianwei@meituan.com>
Date:   Tue Jan 30 16:24:42 2024 +0800

    first commit

最后,通过 git push -f 强制推送至远程仓库即可。

點(diǎn)擊查看更多內(nèi)容
TA 點(diǎn)贊

若覺得本文不錯(cuò),就分享一下吧!

評(píng)論

作者其他優(yōu)質(zhì)文章

正在加載中
Web前端工程師
手記
粉絲
1.4萬
獲贊與收藏
860

關(guān)注作者,訂閱最新文章

閱讀免費(fèi)教程

  • 推薦
  • 評(píng)論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評(píng)論
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會(huì)直接到老師賬戶
支付方式
打開微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得

100積分直接送

付費(fèi)專欄免費(fèi)學(xué)

大額優(yōu)惠券免費(fèi)領(lǐng)

立即參與 放棄機(jī)會(huì)
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

舉報(bào)

0/150
提交
取消