show commit count 显示提交记录数

git rev-list HEAD --count

combine commit or modify commit message 合并或修改记录

  • command 命令
git rebase -i HEAD~$x

其中$x代表你期望操作的记录数,小于提交记录数 $x is the count of commit that you want to combine or change, $x is less than commit count

如 e.g.

你想操作最后十条,则$x为10 if you want to change the last ten commits, the value of $x is 10.

pick 123456 init
pick 7890ab add text
pick cdef12 modify text
pick 345678 modify text

  • edit 编辑

change the "pick" that is in front of the commit line to "s", the commit will combine to previous commit. 在你期望合并的commit将前面的pick更改成s就行, 此条commit将于上一条commit合并

change the "pick to "r", the commit message will be modify. pick改成r表示修改当前提交信息

e.g.例如:

"pick 345678 modify text" --> "s 345678 modify text"

  • change commit message after saving 保存后,重新编写提交信息
 # This is a combination of 2 commits.
 # The first commit's message is:

 modify text

 # This is the 2nd commit message:

 modify text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached at 8658d47
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   ignorelist
 #  modified:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
 change text

 # Please enter the commit message for your changes. Lines starting
 # with '#' will be ignored, and an empty message aborts the commit.
 # HEAD detached from 18e598b
 # You are currently editing a commit while rebasing branch 'master' on 'ddcff57'.
 #
 # Changes to be committed:
 #   (use "git reset HEAD^1 ..." to unstage)
 #
 #  new file:   README.md
 #
 # Untracked files:
 #   (use "git add ..." to include in what will be committed)
 #
  • push 推送至远程
git push -f
标签: git
日期: 2014-03-07 17:30:06, 10 years and 315 days ago
留言

回复不允许使用html标签

通过电子邮件通知我有后续评论.