Scenario:
- Created a Feature Branch From Master(Blue Color Branch)
- Made commits to it
- Later Merged with the Master and Deleted the Branch
- In between, I have created other Feature Branches and made commits to them.
Question: How can I get back the branch I deleted and unmerge so that the master looks clean without the Feature Branch (Blue Color)? I may need to add commits to that Feature Branch in future also.
I have looked at the following resources: Git undo local branch delete Git unmerge a branch
Do I need to do both of the above to get the desired result? Or do I want to create a new branch and revert the commits added in the Feature Branch and merge it?
I am completely confused and please redirect me to the right path. A sample Git Graph for the use-case is given below.
Note: There is no merge in between the Feature Branch (Blue).
var gitgraph = new GitGraph({
template: "metro", // or blackarrow
orientation: "horizontal",
author: "John Doe",
mode: "compact" // or compact if you don't want the messages
});
const master = gitgraph.branch("master");
master.commit("Init the project");
master.commit("Master Commit");
master.tag("v1.0");
const newFeature = gitgraph.branch("feature-1");
newFeature.commit("Feature#1 Commit-1");
master.commit("Hotfix Bug1");
const development = master.branch("development");
development.commit("Development Commit-1");
development.commit("Development Commit-2");
master.commit("HotFix Bug2");
const anotherFeature = master.branch("feature-2");
anotherFeature.commit("Feature#2 Commit-1");
anotherFeature.commit("Feature#2 Commit-2");
newFeature.commit("Feature#1 Commit-2");
newFeature.commit("Feature#1 Commit-3");
master.commit("HotFix Bug3");
master.commit("HotFix Bug4");
newFeature.merge(master, "Release Feature#1");
master.tag("v2.0");
master.commit("Additional Commit-1");
development.merge(master, "Development Merge");
master.commit("Additional Commit-2");
master.tag("HEAD");
<script src="https://cdnjs.cloudflare.com/ajax/libs/gitgraph.js/1.11.4/gitgraph.min.js"></script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Git Graph</title>
</head>
<body>
<canvas id="gitGraph"></canvas>
</body>
</html>