What happens in the child branch if I delete a parent branch in git

拈花ヽ惹草 提交于 2019-12-03 05:44:45
VonC

What happens? nothing.

If you create a branch where another is, you can "delete" that other branch without losing anything. A branch (HEAD) is just a pointer to a commit.
As long as those commits are referenced by a branch HEAD (or are part of the branch HEAD ancestors), they aren't lost.
And even if they are no longer referenced by any branch or tag, they are still in the local reflog for (by default) 90 days.

But, looking at the man page for git branch, this seems easier:

 git branch (-m | -M) [<oldbranch>] <newbranch>

With:

-m
--move

Move/rename a branch and the corresponding reflog.

-M

Move/rename a branch even if the new branch name already exists.

Oriely

Simply use git format-patch origin -o {output_folder}.

After getting all the patches out, go to the master and create a new branch.

Then apply those patches as so: git am {output_folder}/{patch_name}.patch.

Then after verifying you didn't loose any info, you can delete the old branch with git Branch -D {name_old_branch}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!