Git Error: Cannot Delete Branch 'master' - Solution Guide
"Error: Cannot delete branch 'master' checked out at 'C:/web/test/test7.19'" - This error occurs when you attempt to delete the 'master' branch while it's currently checked out in the directory 'C:/web/test/test7.19'. To fix this, you need to switch to a different branch before deleting 'master'. Here's how: \n\n1. Switch to a different branch:\n - Open your command prompt or terminal.\n - Navigate to the 'C:/web/test/test7.19' directory using the cd command.\n - Use git checkout <branch-name> to switch to another branch.\n - After switching, retry deleting 'master' using git branch -d master. \n\n2. Delete from a different location:\n - Open a command prompt or terminal.\n - Navigate to a directory other than 'C:/web/test/test7.19'.\n - Use git branch -d master to delete the 'master' branch. \n\nRemember, deleting a branch is permanent. It removes all commits associated with that branch. Be cautious and back up your work if needed.
原文地址: https://www.cveoy.top/t/topic/pWtz 著作权归作者所有。请勿转载和采集!