得之我幸 失之我命

when someone abandons you,it is him that gets loss because he lost someone who truly loves him but you just lost one who doesn’t love you.

git 修改 commit 信息

先提交了一个 commit 信息,结果错了,想修改,想想之前也搞错了很多作者信息,大概这次可以把强迫症都修补下了。

整理下 git 修改 commit 信息的步骤:

  1. 首先回到想修改的 commit 信息的位置

    • 找到想要修改的 commit 的前一条,复制前一条的 sha1 值前 7 位
      1
      2
      $ git log --oneline
      $ git rebase - i *******
    • 如果是修改最初的那条 commit 就直接
      1
      $ git rebase -i --root
    • 如果是修改刚刚提交最新的 commit,就直接
      1
      $ git commit --amend -m '新的 commit 信息'
    • 如果想要修改作者信息和 commit 信息,则将对应的 pick 改成 edit,保存退出
    • 如果只想要修改 commit 信息,则直接将对应的 pick 改成 reword,保存退出后跳转到 commit 信息编辑,编辑完保存,无需 3、4 步骤
  2. $ git commit --amend --author='* <*@*>'  # --author='* <*@*>' 用来修改作者信息,注意用户名和邮件之间有个空格
    
    1
    2
    3
    4

    4. 上述命令回车后进入修改 commit 信息,修改完保存后,输入下方命令将新的 commit 信息保存到 git 中
    ```bash
    $ git rebase --continue
  3. $ git push --force  # 强制推送到远程仓库,推送前得确认其他人没有推送
    

be slow to promise and quick to perform.