santiagorgb
santiagorgb

Reputation: 11

Git get latest edits on a new branch once I pushed other edits on other branches

first of all I really apologize if this was already answered and I haven't been able to find it after first researching on Stackoverflow and Google as I did.

I am new to Git and I am having trouble understanding a conceptual part of how it works so I would really appreciate your expertise and help.

This is my confusion:

I cloned a repo.

I had only a master branch of course.

Steps: I created a new issue_1 branch and did some edits. Committed them and pushed them to origin.

I did this steps again with 4 other more branches (issue_2, issue_3, issue_4, and issue_5).

So know I have 5 branches with edits done and all of them already committed and pushed separately to origin.

I would like now to create a new branch issue_6 but after creating it I would like to have all the last edits I already did and pushed on the other branches.

What am I missing? How could I be able to see all the edits I've done on this new branch issue_6?

Many thanks in advance.

Upvotes: 1

Views: 29

Answers (1)

JB Nizet
JB Nizet

Reputation: 692121

You need to merge the other branches into your new branch:

git checkout -b issue_6
git merge issue_1
git merge issue_2
git merge issue_3
git merge issue_4
git merge issue_5

now start working on your branch.

EDIT: note that in this case, instead of merging each branch one by one, you could merge them all at once:

git merge issue_1 issue_2 issue_3 issue_4 issue_5

Upvotes: 1

Related Questions