git - Git - 取消合并已删除的分支
问题描述
设想:
- 从主创建一个特征分支(蓝色分支)
- 做出承诺
- 后来与master合并并删除了分支
- 在这期间,我创建了其他功能分支并对它们进行了提交。
问题: 我怎样才能找回我删除并取消合并的分支,以便在没有特征分支(蓝色)的情况下,master 看起来很干净?将来我可能还需要向该功能分支添加提交。
我查看了以下资源: Git undo local branch delete Git unmerge a branch
我是否需要同时执行上述两项才能获得所需的结果?还是我想创建一个新分支并还原在功能分支中添加的提交并合并它?
我完全糊涂了,请把我重定向到正确的道路。下面给出了该用例的示例 Git Graph。
注意:功能分支(蓝色)之间没有合并。
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>
解决方案
推荐阅读
- tensorflow - 如何将 .pb 转换为 TFLite 格式?
- javascript - AngularJS工厂:以文字方式调用父级的最佳方式?
- jsxgraph - 如何仅在两点之间制作垂直线?
- optimization - JVM - Xms 对提交的内存和垃圾收集的影响
- php - 在 macOS 上更新 XAMPP 的 PHP 版本
- javascript - 检查字符串 js 中 2 个字符串的出现次数
- c# - 从 C# 到 PHP 的正确转换函数
- javascript - 如何在 mobx 中实现浅数组复制
- c - libmodbus:modbus_mapping_new() 不能正常工作?
- python - 如何从 tf.data.Dataset.zip((images, labels)) 获取两个 tf.dataset