Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git Tools Rewriting History #1

Open
xgqfrms opened this issue Aug 11, 2022 · 5 comments
Open

Git Tools Rewriting History #1

xgqfrms opened this issue Aug 11, 2022 · 5 comments

Comments

@xgqfrms
Copy link
Owner

xgqfrms commented Aug 11, 2022

Git Tools Rewriting History

https://www.cnblogs.com/xgqfrms/p/16465388.html

before

image

after

commit 82e51b33256a291259eb2b2a66ef0970eb32ea85 (HEAD -> main, origin/main, origin/HEAD)
Author: xgqfrms <xgqfrms@outlook.com>
Date:   Fri Aug 12 01:37:10 2022 +0800

    Create readme.md

commit 6eb693141613af2febc1cc8defd2e934277e57f5
Author: xgqfrms <xgqfrms@outlook.com>
Date:   Fri Aug 12 01:36:40 2022 +0800

    Create readme.md

commit ccf9cf9def54b96bdd6c4fc2bbd46fc13e198a35
Author: xgqfrms <xgqfrms@outlook.com>
Date:   Fri Aug 12 01:26:40 2022 +0800

    Create readme.md

commit 8c9e87e748f106e3734dc2b1741a6b120cb2cf26
Author: xgqfrms <xgqfrms@outlook.com>
Date:   Fri Aug 12 01:25:55 2022 +0800

    Initial commit
~

image

@xgqfrms
Copy link
Owner Author

xgqfrms commented Aug 11, 2022

@xgqfrms
Copy link
Owner Author

xgqfrms commented Aug 11, 2022

编辑器 VIM / VI

$ git rebase -i HEAD~3
hint: Waiting for your editor to close the file... error: There was a problem with the editor 'vi'.
# 写入并退出
:wq!
    

# 写入并强制退出
:wq!

# 强制确认退出
:qa!

作者:xgqfrms
链接:https://www.cnblogs.com/xgqfrms/p/16465388.html
来源:https://www.cnblogs.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
©xgqfrms 2012-2022
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️

@xgqfrms
Copy link
Owner Author

xgqfrms commented Aug 11, 2022

image

image

image

$ git rebase -i HEAD~3
# 等价于
# $ git rebase -i HEAD^2

# 修改 commit
$ git commit --amend

# ???
$ git rebase --continue

$ git push -f

@xgqfrms
Copy link
Owner Author

xgqfrms commented Aug 11, 2022

image

# main
$ git log

@xgqfrms
Copy link
Owner Author

xgqfrms commented Aug 11, 2022

steps ✅

$ git rebase -i HEAD~3
# 等价于
# $ git rebase -i HEAD^2

# 修改 commit
$ git commit --amend

$ git push -f

image

image

image

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant