Hi,

Yes, this is possible. But remember that it can be dangerous to rewrite 
history that has been shared with others (push), so make sure that your 
team are on board and ready to do some resetting in their own repositories 
if they have already pulled this state.

What you have done here is branched out three times, and merged each branch 
back separately.

Before we do anything, let's make a "backup" branch of your current master:

git checkout master
git branch backup

If you want to completely linearize the history, you need take master back 
to the commit before merging in the first branch (the 4th blue ball from 
the bottom). Let's call that revision A:

git checkout master
git reset --hard A

OK, now we have a foundation we can build something linear on. Let's do the 
first branch. Find the revision/SHA of the last commit in this branch 
before it was merged (that would be the 6th blue ball from the bottom). 
Let's call this branch C-branch (where the last commit is C). Recreate the 
branch like this:

git checkout -b C-branch C

Now, we want to update C-branch with the latest changes in master (there 
are two commits in master after C-branch diverged):

git rebase master

Now the two last commits in C-branch should be "on top" of the last commits 
in master branch, and can therefore be fast-forward merged (i.e. linearly):

git checkout master
git merge C-branch

Now, onward to the next branch. Like before, find the SHA of the last 
commit in the branch, that is the 9th blue ball from the bottom). Let's 
call this commit D. As before, we create a branch for it:

git checkout -b D-branch D

Now rebase master, and merge (fast-forward), just like we did for the first 
branch:

git rebase master
git checkout master
git merge D-branch

One more to go. Find the commit E in the last branch, the 2nd blue ball *from 
the top*, create a branch E-branch for it, rebase master, and merge back:

git checkout -b E-branch E
git rebase master
git checkout master
git merge E-branch

After that, it should all be linear. If you run into any conflicts or 
problems on the way, keep cool, read Git's error messages properly, and ask 
again if you need more help. 

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/git-users/-/W8QfJZjH7-UJ.
To post to this group, send email to git-users@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.

Reply via email to