简体   繁体   中英

How can I be certain I only delete my local branch in Git?

Let us suppose I have developed a cool feature and pushed the branch my-cool-feature . I am sure all is ok and I do not need it anymore locally, because the branch will be merged into master .

Using git branch -d my-cool-feature throws some error message If you are sure you want to delete it, run 'git branch -D my-cool-feature' .

Would the use of the "-D" flag delete the branch remotely too or only locally?

Command git branch -D branch-name will delete branch only locally

git branch -D <branch-name> only deletes local branch.

To delete a branch from remote, there is a different command.

git push origin --delete <branch-name>

follow this link.https://www.git-tower.com/learn/git/faq/delete-remote-branch

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM