Reputation: 147
I have a quite strange git request. Here's a portion of my git history:
-----2----- master
/ \
/ 3--- new dev
--1 old dev
I would like to connect 3 to 1 like this:
-----2----- master
/
---1---3--- dev
The old dev and the new branch are now the same branch dev.
Is there a way to achieve this ?
Thanks to those who will answer.
Edit: The rest of my repo looks like this:
-2------5----7--- master
\ / /
3--4----6----- dev
So when I do as chepner said, I end up with this:
-----2------5----7--------- master
\ / /
---1---3--4----6----------- dev
\
3'-------4'--5'--6' newdev
I want the newdev branch to have the same history of my dev branch with history changes made by the command of chepner.
I hope it's clear enough this time.
Upvotes: 3
Views: 286
Reputation: 265956
Branches in Git are simply "labels" and the active label moves with each new commit on this branch. That the old_dev branch was deleted is irrelevant here, the commit was merged and is thus part of the master branch's history.
The solution to your request is quite trivial:
git rebase --onto 1 2 new_dev
It will take all commits from 2..new_dev (excludes 2, includes 3) and place them onto commit 1.
Upvotes: 1