使用TortoiseGit通过rebase-squash影响远程存储库

时间:2015-11-11 15:42:15

标签: git github git-rebase tortoisegit git-squash

正如标题所示

我正在尝试将最后两次提交压缩成一个

https://github.com/dvdvideo1234/Test

并将其注册到Github远程仓库,虽然它只在本地进行更改,而不提交它们。

我是通过日志窗口执行此操作的。右键单击B然后“Rebase master to this ...”

在此过程之后,我希望远程仓库是“A,BCD”,而不是我电脑上的本地仓库。

我应该如何通过TortoiseGIT来做到这一点。我在Windows下使用客户端工作:

TortoiseGit 1.8.16.0 (C:\Program Files\TortoiseGit\bin) 
git version 1.9.5.msysgit.0 (C:\Program Files (x86)\Git\bin; C:\Program Files (x86)\Git\; C:\Program Files (x86)\Git\etc\gitconfig) 

1 个答案:

答案 0 :(得分:0)

这个方法需要GIT bash:

1) Save a local copy of the repo you want to squash
2) Copy the hash of the commit where you want the head to be <NEW_HEAD_COMMIT_HASH> ( for example bf426ff4a0506dae418d09c8b1551fec071e5d84 )
3) Re-base using "git push origin +<NEW_HEAD_COMMIT_HASH>:master"
( for example "git push origin +bf426ff4a0506dae418d09c8b1551fec071e5d84:master" without the quotes )
4) Save a local copy of the re-based repo from 3)
5) Add the modifications from repo 1) to the one you've saved 4)
6) Commit the changes, add one big general log. Done!
相关问题