Wiki Navigation
- Loading...
Question
How do I re-create a branch after it's merged to Master?
Background
Even if a branch has already been merged to 'Master' and deleted, you can recreate it.
When would I need to do this?
Answer
- Do a git log master: --grep=[branchname]
- Merge the remote-tracking branch: remotes/origin/[branchname]
- Checkout the branch and merge you wish to recreate: checkout -b [bramchname] [merge]
Example: log4net branch
- git log master --grep=log4net
it shows up with this merge commit:
*commit 7706a04def9fb08ca4b88b103a13534c20026f74
*Merge: 2b89ef5 7a10a1c
*Author: sebastiii <sebastiii@team-mediaportal.com>
Date: Tue Jan 1 12:43:38 2013**
Merge remote-tracking branch 'remotes/origin/FEAT-3273-Switch_to_log4net'* - The second merge parent is 7a10a1c, so i know the branch pointed to that commit then it was merged
- Do a git checkout -b FEAT-3273-Switch_to_log4net 7a10a1c
This recreates the exact same branch as it was before it was deleted
This page has no comments.