Need Assistance?

support@tutorialshub.in

Branches and Merging

Deleting and renaming branches

ADVERTISEMENT
Git Free Lesson
5 min read
ADVERTISEMENT

Clean up completed branches

After a feature has been merged, deleting the local branch reduces clutter. Branch deletion normally removes the branch reference, not the commits that are still reachable from other references.

Safe and force deletion

git branch -d performs a safety check and normally refuses to delete a branch with unmerged work. -D overrides that check, so use it only when you are certain the commits are no longer needed.

Rename branches carefully

Renaming a local branch is easy, but a remote branch and collaboration workflow may require additional steps. Coordinate branch renames when other developers already use the old name.

ADVERTISEMENT