日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

三分钟教你学Git(二十七) - 修改多个commit

發布時間:2024/3/24 编程问答 34 豆豆
生活随笔 收集整理的這篇文章主要介紹了 三分钟教你学Git(二十七) - 修改多个commit 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

比如我們又一個歷史提交A->B->C->D, 當前HEAD在D commit上,我們想要修改B,C?commits,該怎么做呢?

我們知道用git commit --amend可以修改當前的提交D,但是之前的怎么辦呢?

首先我們要修改的起點開始于最近的三次提交,告訴git:

1 git rebase -i HEAD~3

然后git會告訴你現在的status:

pick a1?message of a1

pick a2?message of a2

pick a3?message of a3

?

# Rebase a10d0f8..b5f4d0d onto a10d0f8

# 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 <commit> = like "squash", but discard this commit's log message

# 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>]

# . create a merge commit using the original merge commit's

# . message (or the oneline, if no original merge commit was

# . specified). Use -c <commit> to reword the commit message.

?

2 上邊列出了你想要修改的命令, 比如我們只想修改最近三次的提交message:

reword a1?message of a1

reword a2?message of a2

pick a3?message of a3

3 然后退出并保存。

4 然后Git就會從commit B開始讓你進行修改。然后按照正常的流程修改完畢就行。

5 最后可以git log看一下歷史commit是否跟你的預期相符,好了,搞定了。

?

原文:http://blog.csdn.net/hongchangfirst/article/details/111056451

作者:hongchangfirst

hongchangfirst的主頁:http://blog.csdn.net/hongchangfirst

總結

以上是生活随笔為你收集整理的三分钟教你学Git(二十七) - 修改多个commit的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。