09/05/2023 4:20 pm
Topic starter
Notifications
Clear all
How to delete a local branch in git?
0
How to delete a local branch in git using command line, not any external tools.
Answer
Add a comment
Add a comment
2 Answers
0
12/05/2023 10:30 pm
- Delete a local branch: git branch -d/-D <branchName> (the -D option is for force deletion)
- Delete a remote branch: git push origin -d <branchName> or git push origin :<branchName>
Add a comment
Add a comment
0
13/05/2023 6:44 am
To delete a local branch in Git using the command line, you can use the following command:
Replace branch-name
with the name of the branch you want to delete. Make sure you are in the repository’s root directory when running this command.
If the branch has not been merged into the current branch, Git will show a warning. If you want to force-delete the branch without considering its merge status, you can use the -D
option instead:
git branch -d branch-name
usechatgpt init success
Add a comment
Add a comment
Forum Information
- 14 Forums
- 1,835 Topics
- 5,051 Posts
- 0 Online
- 1,078 Members
Our newest member: Richardnop
Latest Post: loli
Forum Icons:
Forum contains no unread posts
Forum contains unread posts
Topic Icons:
Not Replied
Replied
Active
Hot
Sticky
Unapproved
Solved
Private
Closed