2013-04-27 67 views
1

在做一些git rebasing时,我自己扭曲了。在下面的图表中,我想stable指向承诺6016f6,并且我希望所有其他提交“above”6016f6消失。换句话说,我有BEFORE,但我想AFTER重新绑定后删除一些推送提交

BEFORE:

* commit 725b5f (origin/fixpaths) 
|\ Merge: 6016f65 e91c3aa 
| | Date: Sat Apr 27 07:04:05 2013 -0700 
| | 
| |  Merge branch 'fixpaths' of wayfare.example.org:/modules/base into fixpaths 
| | 
| * commit e91c3a 
| | Date: Fri Apr 26 16:49:39 2013 -0700 
| | 
| |  fix permissions on many cron files 
. 
. 
. 
| * commit 160460 
| | Date: Fri Apr 26 14:35:14 2013 -0700 
| | 
| |  module paths cleanup for dns.pp 
| | 
| * commit ecbfd6 
| | Date: Fri Apr 26 14:23:30 2013 -0700 
| | 
| |  fix module paths in cron base module 
| | 
* | commit 6016f6 (HEAD, fixpaths) 
|/ Date: Fri Apr 26 14:23:30 2013 -0700 
| 
|  Change module paths to work with base module. 
| 
* commit 88d0bc (origin/stable, stable) 
| Date: Mon Apr 22 15:51:44 2013 -0700 
| 
|  committing everything for branch stable 
|  
| * commit 9baf5a (tag: release/latest, origin/master, origin/HEAD, master) 
|/ Date: Wed Apr 24 14:47:23 2013 -0700 
| 
|  Fix permissions on all of the cron jobs 

AFTER:

* commit 6016f6 (HEAD, stable, origin/stable) 
|/ Date: Fri Apr 26 14:23:30 2013 -0700 
| 
|  Change module paths to work with base module. 
| 
* commit 88d0bc 
| Date: Mon Apr 22 15:51:44 2013 -0700 
| 
|  committing everything for branch stable 
|  
| * commit 9baf5a (tag: release/latest, origin/master, origin/HEAD, master) 
|/ Date: Wed Apr 24 14:47:23 2013 -0700 
| 
|  Fix permissions on all of the cron jobs 

(注:为了节省一些空间,我已经被截断哈希并删除了作者行)。

回答

0

你做最困难的部分 - 设想你想要什么树的样子。现在只要将分支标记周围与之相匹配的:

$ # Move 'stable' branch marker up 
$ git checkout stable 
$ git merge --ff-only 6016f65 
$ git push origin stable 

现在,该怎么办“fixpaths” - 无论是拉了回来远程“fixpaths”到(以下2种方式)符合当地或只是删除本地

$ # Delete the remote fixpaths and repush the local one 
$ git push origin :fixpaths 
$ git push origin fixpaths 

$ # Force the remote 'fixpaths' branch marker backward to your local 'fixpaths' 
$ # (Note: generally push -f is inadvisable unless you understand what you are doing) 
$ git push -f origin fixpaths 

$ # Or else delete fixpaths because you don't need it anymore 
$ # Caution: this will 'delete' the local and remote branches 
$ git branch -d fixpaths 
$ git push origin :fixpaths 
:和远程分支机构,因为你用它(低于去年的方式)来完成
0

git checkout stablegit cherry-pick 6016f6。如果我理解正确,只需挑选额外提交到stable分支,并设置好即可。

相关问题