首页 > 其他 > 详细

[Git] --amend

时间:2019-12-12 17:43:49      阅读:109      评论:0      收藏:0      [点我收藏+]

Change a Commit Message that Hasn‘t Been Pushed Yet

If you make a mistake in a commit message but HAVEN‘T pushed it yet, you can change that commit message with --amend:

git commit --amend -m "New message"

This won‘t change any of the files in your commit - but will rewrite the commit with the new message.

Add More Files and Changes to a Commit Before Pushing

To add more files to the most recent commit, we can add them to the staging area with:

git add -A

and then rewrite the most recent commit to include them with:

git commit --amend -m "My new message"

Caution: only do this BEFORE you‘ve pushed the commits - otherwise you will be re-writing history for people who may have already pulled down the old commits.

技术分享图片

 

[Git] --amend

原文:https://www.cnblogs.com/Answer1215/p/12030073.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!