![]() There's one big problem here: you did not ask how to do this locally but rather how to do it on GitHub, GitLab, Bitbucket, and so on. do done loop is a shell (sh/bash) construct, not a Git command in other command line interpreters you may need other commands, or you can just run one git branch -D per branch. Git checkout -b main # or whatever name you want here Hence, the recipe for doing this, assuming you have no tags, no stashes, and so on, is: git checkout -orphan fakebranchįor name in do git branch -D $name done 1 You can now change the name of the branch you are on, that does not exist, to some other name-the name you want to come into existence in the future, when you make the initial commit-using git checkout -b or git switch -c. That makes it possible to delete all the other branches. This puts your Git back in that odd state of being on a branch that does not exist. So you must use git checkout -orphan or git switch -orphan to set things up so that the current branch is a branch that does not exist. This requires one special trick, because you are never allowed to delete the current branch, whatever it is. ![]() Locally, you can get back to this state-well, almost see footnote 1-simply by deleting every branch. Oddly enough, though, you're on your initial branch-whatever it will be-at this point, even though it does not exist. A totally-empty repository, as freshly created by git init, has no commits and no branches (and no tags, and so on). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |