User Tools

Site Tools


rename_branch

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
rename_branch [2021/01/19 14:26] – создано chifekrename_branch [2023/09/14 06:06] (current) – external edit 127.0.0.1
Line 14: Line 14:
  
  
 +===== How do I delete a local branch in Git? =====
 +
 +Git makes managing branches really easy - and deleting local branches is no exception:
 +
 +<code>git branch -d <local-branch></code>
 +
 +In some cases, Git might refuse to delete your local branch: when it contains commits that haven't been merged into any other local branches or pushed to a remote repository. This is a very sensible rule that protects you from inadvertently losing commit data.
 +
 +If you want to delete such a branch nonetheless (e.g. because you've programmed yourself into a dead end and produced commits that aren't worth keeping) you can do so with the "-D" flag:
 +
 +<code>git branch -D <local-branch></code>
rename_branch.1611066396.txt.gz · Last modified: 2023/09/14 06:06 (external edit)