假设我想将提交的文件app/views/devise/passwords/edit.html.haml
从提交4d4d4b2
重新排列到提交46c6be3
。
我怎么能以更简单的方式做到这一点?
我只能想到回滚所有提交并再次重新提交。
+ bafdafa (HEAD, feature/add-omniauth-support) add gems for omniauth fb
| Gemfile | 11 ++++++-----
| 1 file changed, 6 insertions(+), 5 deletions(-)
+ 46c6be3 add omniauth facebook+ devise integration together
| app/controllers/omniauth_callbacks_controller.rb | 6 ++++++
| app/models/user.rb | 14 +++++++++++++-
| 6 files changed, 69 insertions(+), 6 deletions(-)
+ a7d7600 add haml gem
| Gemfile | 4 ++++
| 2 files changed, 13 insertions(+), 8 deletions(-)
+ 056aae1 refactor: login form view---------
| app/views/devise/shared/_links.html.haml | 28 +++++++++++++++-------------
| 3 files changed, 40 insertions(+), 30 deletions(-)
+ 4d4d4b2 generate devise view then convert to haml
| app/views/devise/confirmations/new.html.haml | 10 ++++++++++
| app/views/devise/passwords/edit.html.haml | 19
答案 0 :(得分:0)
rebase -i
可能有更聪明的方法,但你可以从回购的根源开始:
# Create a commit like 4d4d4b2 but without the file we don't want
git checkout 4d4d4b2^
git checkout 4d4d4b2 -- .
git reset -- app/views/devise/passwords/edit.html.haml #if instead you want to keep part of your edits of this file, 'git gui' may be useful
git commit -m "generate devise view then convert to haml"
# Re-apply the other commits
git cherry-pick bafdafa^^^
git cherry-pick bafdafa^^
git cherry-pick bafdafa^ # this one is actually 46c6be3
# Before going on, we want to add our file
git checkout 4d4d4b2 -- app/views/devise/passwords/edit.html.haml
git log -n 1 --pretty=tformat:%s%n%n%b | git commit -a -F - --amend
#Finally, re-apply the last commit
git cherry-pick bafdafa