Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What happens if I git delete a remote branch that has subbranch that has not been merged to it

I'm getting rid of the development (in purple) branch and having all subbranches branch from master (in teal) and merge to master. development branch is branched from master. If there are sub branches off development that have not been merged yet, will they be able to be merged to master later, after the remote development branch is removed? What is the fate of the leaf (mustard colored) branch.

enter image description here

like image 984
claya Avatar asked Apr 29 '15 00:04

claya


People also ask

Does deleting a branch delete sub branches?

Mikkel Rasmussen. It would not delete the bar_feature branch. From the article: If the branch was merged into another branch before it was deleted then all of the commits will still be reachable from the other branch when the first branch is deleted. They remain exactly as they were.

Can I delete a branch without merging?

The -d option will delete the branch only if it has already been pushed and merged with the remote branch. Use -D instead if you want to force the branch to be deleted, even if it hasn't been pushed or merged yet.

How do you delete a branch which is not merged to any other branch?

Deleting Local Branches First, use the git branch -a command to display all branches (both local and remote). Next, you can delete the local branch, using the git branch -d command, followed by the name of the branch you want to delete.

Is it okay to delete a branch in your remote repository?

It is safe to delete your local branch after you pushed your changes to your own remote repository. The pull request is unrelated to this, because it is simply a request to the maintainers of the original repository to merge your changes back into their code base.


1 Answers

A branch in git is essentially not much more than a pointer to a commit. When you remove a branch you do not remove the commits, so the "subbranch" (not really an accurate term) will be in tact, and will still be mergeable.

like image 64
Mike Atkins Avatar answered Oct 11 '22 16:10

Mike Atkins