0

I have a master branch from which I created branch 1 and 2. The branch 1 I made some change and committed and merged with master. Now that I have already taken a new branch 2 the change made to master is not available there. But I need the change in 1 to continue development of branch 2.

How do I do it?

Update: Some changes has been made in branch2 already. Otherwise I would have just deleted that branch and created branch2 again from master. I need branch2 change as well as the branch1 change that has already been merged to master.

1
  • Have there been any other changes to master between creating 2 and merging 1 back to master? There is a number of ways you can get those changes into 2 but the exact way depends on what other changes have been made. You could possibly merge 1 into 2, merge master into 2, cherry-pick the exact commits you want to 2 or perform an interactive rebase. It's hard to say which way would be the best with just the information you've provided so far. Commented Jul 6, 2014 at 8:07

1 Answer 1

2

You can rebase your branch2 on top of master (which already includes changes from branch1).

Using git rebase:

git checkout branch2 git rebase master 
Sign up to request clarification or add additional context in comments.

1 Comment

@AkhilKNambiar what did you see as an error? The rebase is supposed to replay branch2 on top of master, which already includes branch1: that shouldn't "not work".

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.