githug rename_commit 修改已经commit但还没push的一条message
githug 第 45 关, 一开始对 git rebase -i 这个东西有误解, 记录一下正确的用法
ddmobadeMac-mini:git_hug ddmoba$ githug reset 45
********************************************************************************
* Githug *
********************************************************************************
resetting level
Name: rename_commit
Level: 45
Difficulty: ***
Correct the typo in the message of your first (non-root) commit.
ddmobadeMac-mini:git_hug ddmoba$
查找有拼写错误的那一条 commit
ddmobadeMac-mini:git_hug ddmoba$ git log
commit d30bc005638c278714faaa73f0fdc16052561750 (HEAD -> master)
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
Second commit
commit 4f1341ac9134225719e5d704e420160657e8c38e
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
First coommit
commit a632e3dfa31a06bcec9395c0690d43a3f2f09706
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
Initial commit
ddmobadeMac-mini:git_hug ddmoba$
First coommit // commit 写错了
git rebase -i parent_of_flawed_commit
ddmobadeMac-mini:git_hug ddmoba$ git rebase -i a632e3dfa31a06bcec9395c0690d43a3f2f09706
然后跳到
pick 4f1341a First coommit
pick d30bc00 Second commit
# Rebase a632e3d..d30bc00 onto a632e3d (2 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
~
~
~
~
~
~
~
~
~
~
~
~
"~/git_hug/.git/rebase-merge/git-rebase-todo" 21L, 693C
编辑它,
r 4f1341a First coommit
pick d30bc00 Second commit
# Rebase a632e3d..d30bc00 onto a632e3d (2 commands)
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
# d, drop = remove commit
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
然后 :x 保存, 会跳到
First coommit
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri Jun 29 11:35:05 2018 +0800
#
# interactive rebase in progress; onto a632e3d
# Last command done (1 command done):
# r 4f1341a First commit
# Next command to do (1 remaining command):
# pick d30bc00 Second commit
# You are currently editing a commit while rebasing branch 'master' on 'a632e3d'.
#
# Changes to be committed:
# new file: file1
#
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"~/git_hug/.git/COMMIT_EDITMSG" 17L, 520C
编辑它, 把 coommit 改成 commit
First commit
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# Date: Fri Jun 29 11:35:05 2018 +0800
#
# interactive rebase in progress; onto a632e3d
# Last command done (1 command done):
# r 4f1341a First commit
# Next command to do (1 remaining command):
# pick d30bc00 Second commit
# You are currently editing a commit while rebasing branch 'master' on 'a632e3d'.
#
# Changes to be committed:
# new file: file1
#
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
-- INSERT --
然后 :x 保存, 跳到
ddmobadeMac-mini:git_hug ddmoba$ git rebase -i a632e3dfa31a06bcec9395c0690d43a3f2f09706
[detached HEAD ea3efe3] First commit
Date: Fri Jun 29 11:35:05 2018 +0800
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file1
Successfully rebased and updated refs/heads/master.
然后 git log 查看一下是否修改成功
ddmobadeMac-mini:git_hug ddmoba$ git log
commit 1f929783b1acb295aaf7b9dbe500629a1054484f (HEAD -> master)
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
Second commit
commit ea3efe310a6a03a232171bf664401f62a5dc024e
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
First commit
commit a632e3dfa31a06bcec9395c0690d43a3f2f09706
Author: hangj <hangj@protonmail.com>
Date: Fri Jun 29 11:35:05 2018 +0800
Initial commit
ddmobadeMac-mini:git_hug ddmoba$
done !!
githug rename_commit 修改已经commit但还没push的一条message的更多相关文章
- git 检查是否有commit到本地但还没push的代码
使用 git status 命令可以得到以下结果 $ git status On branch dev_getTicketCnt Your branch is ahead of 'origin/mas ...
- Git 还没push 前可以做的事(转)
Git 版本控制系統(3) 還沒 push 前可以做的事 转载:http://ihower.tw/blog/archives/2622 這一集要講的是:還沒 push 前可以做的壞事,也就是 re ...
- git删除已经提交的包含敏感信息的文件(还没提交到远程仓库)
写好的代码已经提交了(但还没push到github),发现某个文件里包含密码.如果push的话,密码可就被公开了.如果在代码里改掉密码,再commit一次,也不行,历史提交记录还是会上传到github ...
- 谁还没遇上过NoClassDefFoundError咋地——浅谈字节码生成与热部署
谁还没遇上过NoClassDefFoundError咋地--浅谈字节码生成与热部署 前言 在Java程序员的世界里,NoClassDefFoundError是一类相当令人厌恶的错误,因为这类错误通常非 ...
- C-Lodop提示“网页还没下载完毕,请稍等一下再操作.”
该提示在Lodop旧版本中是: 提示"WebSocket没准备好,点确定继续",提示“C-Lodop没准备好”,新版本修改了该提示的描述“网页还没下载完毕,请稍等一下再操作.”,让 ...
- .Net Actor 服务端开发框架,Newbe.Claptrap 项目周报 1 - 还没轮影,先用轮跑
Newbe.Claptrap 项目周报 1,第一周代码写了一点.但主要还是考虑理论可行性. 第一次接触本框架的读者,可以先点击此处阅读本框架相关的基础理论和工作原理. 周报是啥? 成功的开源作品,离不 ...
- 不会吧,你连Java 多线程线程安全都还没搞明白,难怪你面试总不过
什么是线程安全? 当一个线程在同一时刻共享同一个全局变量或静态变量时,可能会受到其他线程的干扰,导致数据有问题,这种现象就叫线程安全问题. 为什么有线程安全问题? 当多个线程同时共享,同一个全局变量或 ...
- gRPC趁现在还没大火,抢先了解一下
前言 系统分布式已经成为程序员的家常,将大型单体划分为相对简单的小模块,分散系统能力,提升系统扩展性.功能模块复用性等:各功能模块之间肯定会有很多数据共享和交互的应用场景,那就避免不了各模块之间的通信 ...
- 升级过log4j,却还没搞懂log4j漏洞的本质?
摘要:log4j远程代码漏洞问题被大范围曝光后已经有一段时间了,今天完整讲清JNDI和RMI以及该漏洞的深层原因. 本文分享自华为云社区<升级过log4j,却还没搞懂log4j漏洞的本质?为你完 ...
随机推荐
- <记录>TP5 关联模型使用(嵌套关联、动态排序以及隐藏字段)
在数据库设计中,常常会有如下这种关联模型,分类表中一条分类对应多个商品表中的商品 如果要获得分类表中每条分类 以及 对应的商品的信息,则需要先查询分类表中的数据,然后根据结果遍历查询商品表,最后把数据 ...
- Linux网络编程学习(五) ----- 信号(第四章)
1.基本概念 进程阻塞: 进程执行条件得不到满足,就自动放弃CPU资源而进入休眠状态,以等待条件满足,当条件满足时,系统就将控制权还给该进程进行未完成的操作 共享资源: 进程间协调使用的系统资源 锁定 ...
- Linux jdk安装
Linux上一般会安装Open JDK,关于OpenJDK和JDK的区别:http://www.cnblogs.com/sxdcgaq8080/p/7487369.html 下面开始安装步骤: --- ...
- 小强学渲染之OpenGL状态机理解
状态机是理论上的一种机器,呃这个说法非常非常的抽象.通俗一点理解,状态机描述了一个对象在其生命周期内所经历的各种状态,状态间的转变,发生转变的动因,条件及转变中所执行的活动.或者说,状态机是一种行为, ...
- HDU 5734 Acperience(数学推导)
Problem Description Deep neural networks (DNN) have shown significant improvements in several applic ...
- java 遇到的问题
1.list.sort(new Comparator<String>() { @override public int compare(String o1, String o2) { re ...
- 将VSCode设置成中文语言环境
VSCode是一款轻量级的好用的编译软件,今天小编来将软件默认的英文语言环境变为我们熟悉的中文语言环境. 工具/原料 电脑一台 安装有VSCode 方法/步骤 首先打开VSCode软件,可 ...
- Netsharp总体介绍
作者:秋时 日期:2014年02月05日 转载须说明出处 Netsharp交流群:338963050(请有详细的请求说明) Netsharp系列文章目录结构 Netsharp是一款免费的基于 ...
- Powerdesigner数据库建模的浅谈
1.建立新模型 2.创建物理数据模型(可以选择数据库类型及版本) 3.建立表 左键点击Table这个图标,鼠标移动到空白工作区,再左键,一个表的视图就出来了,(连续左键,会出现多个表的视图),右键退出 ...
- SpringBoot编写自定义Starter
根据SpringBoot的Starter编写规则,需要编写xxxStarter依赖xxxAutoConfigurer,xxxStarter是一个空的jar,仅提供辅助性的依赖管理,引入其他类库 1.建 ...