https://stackoverflow.com/questions/179123/how-to-modify-existing-unpushed-commits
Amending the most recent commit message
git commit --amend
will open your editor, allowing you to change the commit message of the most recent commit. Additionally, you can set the commit message directly in the command line with:
git commit --amend -m "New commit message"
…however, this can make multi-line commit messages or small corrections more cumbersome to enter.
Make sure you don't have any working copy changes staged before doing this or they will get committed too. (Unstaged changes will not get committed.)
Changing the message of a commit that you've already pushed to your remote branch
If you've already pushed your commit up to your remote branch, then you'll need to force push the commit with
git push <remote><branch>--force
# Or
git push <remote><branch>-f
Warning: force-pushing will overwrite the remote branch with the state of your local one. If there are commits on the remote branch that you don't have in your local branch, you will lose those commits.
Warning: be cautious about amending commits that you have already shared with other people. Amending commits essentially rewrites them to have different SHA IDs, which poses a problem if other people have copies of the old commit that you've rewritten. Anyone who has a copy of the old commit will need to synchronize their work with your newly re-written commit, which can sometimes be difficult, so make sure you coordinate with others when attempting to rewrite shared commit history, or just avoid rewriting shared commits altogether.
Use interactive rebase
Another option is to use interactive rebase.
This allows you to edit any message you want to update even if it's not the latest message.
In order to do a git squash, follow these steps:
// X is the number of commits to the last commit you want to be able to edit
git rebase -i HEAD~X
Once you squash your commits - choose the e/r
for editing the message
相关推荐
【EUCALYPTUS源码修改指南2.0.2版】 EUCALYPTUS(欧洲云)是一款开源的云计算平台,用于构建私有云和混合云环境。本指南将详细介绍如何在Eclipse集成开发环境中修改EUCALYPTUS 2.0.2的源代码。...
在本文中,我们将详细介绍如何在Eclipse环境中修改Eucalyptus源代码,特别是针对Eucalyptus 2.0.2版本。Eucalyptus(欧洲云杉)是一个开源的云计算平台,它允许用户在自己的数据中心创建类似Amazon Web Services ...
在SAP系统中,ESS(Employee Self-Service)是企业员工自助服务的组成部分,它允许员工访问和管理个人信息,如工资单、出勤记录、休假申请等。而NWDI(NetWeaver Development Infrastructure)是SAP提供的一个开发和...
ASP.NET Core 1.1 For Beginners: How to Build a MVC Website by Jonas Fagerberg English | 19 May 2017 | ASIN: B071VX7KN4 | 411 Pages | PDF | 6.66 MB Want to learn how to build ASP.NET Core 1.1 MVC Web ...
You will also be able to modify existing software that is written in GW-BASIC. <br>This guide is designed to help you use the GW-BASIC Interpreter with the MS-DOS?operating system. Section 1.5 ...
This friendly, solutions-oriented guide is filled with step-by-step examples that illustrate how to write basic to advanced JavaScript applications, as well as modify existing scripts to suit ...
5. 修改 `DataTable` 中已有单元格的值:要修改 `DataTable` 中某个单元格的值,应该使用 `Modify Cell` 活动。 6. Collections 类别中的数据类型:Collections 类别包括 `Dictionary`、`List` 和 `Array` 这些数据...
Have you always wanted to learn ...How to modify text and font of a website How to create navigation bars How to create gorgeous looking tables to display your data
【标签】"modify 谷歌插件"进一步明确了这个压缩包的内容。"modify"可能指的是插件能够修改或查看HTTP头信息,而"谷歌插件"则明确了这是与谷歌浏览器兼容的扩展程序,用户只需将其安装到Chrome浏览器上,即可享受到...
But for me, there were a lot of things that I wanted somehow to modify or improve, somewhere to simplify or to generify the code with creating Base-classes, somewhere to separate or move the code to ...
Now, write some new code or change some existing code to make all of the new/modified tests pass. If you do everything correctly, you should feel safe to make these changes as your existing test ...
delete the data using the DELETE statement, and how to update existing data using the UPDATE statement. This chapter also covers the SELECT…INTO, MERGE, and TRUNCATE TABLE statements, and it ...
It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex ...
It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex ...
It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex ...
It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex ...
It can be used to modify existing classes or dynamically generate classes, directly in binary form. Provided common transformations and analysis algorithms allow to easily assemble custom complex ...