Reputation: 42379
Here's how my repo looks like now:
I created branch i449
from develop
some time ago to work on an issue. Then I realized that I had made some changes that belonged to another issue, so I created the branch i447
from i449
.
I finished working on the initial issue so I have now merged i449
into develop
and pushed the changes (git push origin develop
). Now I would like to delete the i449
branch, since it serves no purpose anymore. My fear is that, since i447
was created from it, deleting i449
will mess up i447
which contains important changes.
What will happen to i447
if I do thi
s?
# Delete remote branch
git push origin --delete i449
# Delete local branch
git branch -d i449
Is this the proper way to handle this?
For the sake of completeness, here's how the repo looks after deleting i449
:
Now my doubt is what will happen when I try to merge i447
into develop
, but I guess I'll see.
Upvotes: 0
Views: 61
Reputation: 22017
The only thing that will be deleted here is the reference named i449
, not the commits it now happens to reference.
Since these commits still are part of the tree and referenced through 1) the merge commit you made on develop
and 2) the i447
branch itself, they keep being referenced so they will stay.
Go for it.
Upvotes: 1
Reputation: 37772
yes you can safely delete the branch i449
, this won't change anything to the history of your i447
branch.
Each branch is only a reference to a git commit. Your branch i447
still refers to its own commit, which won't change.
Upvotes: 1
Reputation: 30242
Nope.... you can delete them at will... branches are just pointers to revisions so they can be created/moved around/deleted..... if you have a branch pointed to a later revision, that won't be affected by deleting the branch.
Upvotes: 1