0

My current git tree is

A-B-C (branch 1)
    |
    E-F-G (branch 2)
        |
        H-I (branch 3)

I want to rebase (edit) in commit B of branch 1 and it should reflect/propagate that edit commit in all other sub branches of branch 1. Is it possible?

gaurav arora
  • 195
  • 3
  • 11
  • 1
    Possible duplicate of [Git: How to rebase many branches (with the same base commit) at once?](http://stackoverflow.com/questions/866218/git-how-to-rebase-many-branches-with-the-same-base-commit-at-once) – kan May 07 '17 at 08:59
  • I have seen the above link... I guess it is rebasing onto?.... And its moving a commit ahead from upstream... What i need is to edit the previous commit in history from a base branch.. And revise all its instances.. Could you please tell me more about your approach? – gaurav arora May 07 '17 at 10:32
  • If its simply few branches you can use cherry pick on each sub branch to take that particular commit. – Ayon Nahiyan May 07 '17 at 12:11
  • Did that already :) but trying for a robust solution to handle it in big projects – gaurav arora May 07 '17 at 12:13
  • `git rebase -i` – Ôrel May 07 '17 at 14:42
  • Possible dupe of https://stackoverflow.com/questions/43711961/rebase-a-branch-that-has-child-branches - but unfortunately that question doesn't have a succinct solution. – Bert F May 07 '17 at 15:22
  • 1
    What exactly do you mean by "big projects"? The number of files and such in those commits shouldn't make a big difference in the process but if you mean "projects where lots of people are involved" then I would recommend you stay away from rebasing in this case, unless all of those branches are "yours". Rewriting history when multiple people are working together is not a good workflow. – Lasse V. Karlsen May 07 '17 at 15:52
  • Yes... That is a good advice, thanx, but just to be having a utility that could work in worse case.. I am trying.. And by big projects i meam that if we are having a lot of branches in the same manner as above and a similar fix needs to be provided to all – gaurav arora May 07 '17 at 15:53
  • If the fix simply needs to be provided to all the branches, make another branch out from B, commit your fix there, then merge that branch into all the branches you want the fix in. No need to rewrite history at all. – Lasse V. Karlsen May 07 '17 at 16:04
  • That is what i did, but just in case where history needs to be edited.. Just a case – gaurav arora May 07 '17 at 16:05

0 Answers0