有時候 commit 後才意識到還未 pull,這個時候會有以下提示:ssh
wlan-0-182:mobile-v2 lixiumei$ hg pull -u
pulling from ssh://hg@bitbucket.org/ifanr/socialbase
searching for changes
adding changesets
adding manifests
adding file changes
added 74 changesets with 193 changes to 155 files (+3 heads)
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
updated to "70b155edd91c: 1. 移動端增長獲取插件詳情接口;2. 更新 iconfont; 3. utils 增長時間格式處理和跳轉至註冊頁的方法"
1 other heads for branch "feature/trochili-plugin-market-v1.0"編輯器
hg heads:ide
wlan-0-182:mobile-v2 lixiumei$ hg heads
changeset: 34748:a0daa4aa2008
branch: feature/hydrogen-menu-iterative
tag: tip
parent: 34741:665610d5fb59
user: Zeshuan Zhang <zhangzeshuan@ifanr.com>
date: Sat Apr 28 13:39:49 2018 +0800
summary: BAAS-2052 #comment 修復 HDevSidebar 子菜單摺疊 bug插件
想要達到的效果:撤銷剛纔的 commit,而且保持本地更改不變,commit 的文件回退到 commit 前的狀態(也就是說,全部的更改不會丟失)blog
方法:接口
第一步:hg out/outgoing(查看打算撤銷的 commit 的 changeset)ip
wlan-0-182:mobile-v2 lixiumei$ hg outgoing
comparing with ssh://hg@bitbucket.org/ifanr/socialbase
searching for changes
changeset: 34749:70b155edd91c
branch: feature/trochili-plugin-market-v1.0
tag: tip
parent: 34726:06d8ccdad119
user: lixiumei <lixiumei@ifanr.com>
date: Thu May 03 11:17:27 2018 +0800
summary: 1. 移動端增長獲取插件詳情接口;2. 更新 iconfont; 3. utils 增長時間格式處理和跳轉
至註冊頁的方法ci
第二步:hg strip --keep -r <changeset>rem
若是 hg 提示:hg: unknown command 'strip'it
那麼,進入 .hg 目錄,目錄下有文件 hgrc,執行 vi hgrc, 在 [extensions] 下添加 strip = ,保存退出便可。(或者使用編輯器修改 hgrc):
再次執行 strip
wlan-0-182:mobile-v2 lixiumei$ hg strip --keep -r 34749
saved backup bundle to /Users/huanghao/sso/.hg/strip-backup/70b155edd91c-e339a7d0-backup.hg
使用 hg outgoing 查看撤銷是否成功
wlan-0-182:mobile-v2 lixiumei$ hg outgoing
comparing with ssh://hg@bitbucket.org/ifanr/socialbase
searching for changes
no changes found
撤銷成功!