Error Cannot Delete The Branch Which You Are Currently On
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About error cannot delete the branch 'develop' which you are currently on Us Learn more about Stack Overflow the company Business Learn more about hiring
Cannot Delete The Branch Which You Are Currently On Git
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join
Cannot Delete The Branch 'master' Which You Are Currently On
the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up How can I delete (or
Cannot Delete Branch Checked Out At
merge) a local Git branch that I'm currently on? up vote 19 down vote favorite 2 I'm pretty new to using git, and I use it to contribute to the AOKP Android ROM. I've successfully created a few branches, modified the code, and uploaded the commits that have gotten merged on the remote end. But in my local repository, those branches are still showing up (even error: cannot delete branch checked out at though they show up as having no changes). The problem is that when I created those branches, I did so right from the subfolder that needed to be modified, so I don't have any "higher" branches to go to. And because of that, I can't delete those branches -- git tels me error: Cannot delete the branch 'MyMods' which you are currently on. So what can I do to get rid of those branches? git git-branch repository share|improve this question asked Sep 26 '12 at 16:50 user496854 2,14072559 Git doesn't allow this because it's a bit intelligent than these folk: youtube.com/watch?v=zE8el_qscvE –Krumia Jul 13 '15 at 7:11 add a comment| 3 Answers 3 active oldest votes up vote 21 down vote Checkout a different branch first, before deleting it: git checkout master git branch -d MyMods Also, branches have nothing to do with folders. Git always tracks the whole repository at once, with all its folders and files. A branch is nothing else than a pointer to a single commit, or snapshot, in the history of the repository. share|improve this answer answered Sep 26 '12 at 16:50 poke 128k27199267 I u
Sign in Pricing Blog Support Search GitHub This repository Watch 168 Star 1,798 Fork 714 gitextensions/gitextensions Code branches cannot be deleted unless merged into another branch Issues 613 Pull requests 65 Projects 0 Wiki Pulse Graphs error: pathspec 'master' did not match any file(s) known to git. New issue Cannot delete the branch 'mybranch' which you are currently on. #1113 Closed PBastiani opened git delete master branch this Issue Jul 12, 2012 · 3 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants http://stackoverflow.com/questions/12606612/how-can-i-delete-or-merge-a-local-git-branch-that-im-currently-on PBastiani commented Jul 12, 2012 Delete branch Dialog box : could you remove the current branch from the combobox ? This will avoid the following Git error message : "Cannot delete the branch 'mybranch' which you are currently on." Git Extensions member KindDragon commented Jul 12, 2012 Than user ask us why he https://github.com/gitextensions/gitextensions/issues/1113 cannot delete that branch. vcpp commented Jul 13, 2012 May be, replace question with: “You are about to delete branch which you are currently on. Detach head and delete branch anyway?”. vcpp added a commit to vcpp/gitextensions that referenced this issue Jul 18, 2012 vcpp #1113 8cc995c vcpp commented Jul 18, 2012 I couldn't think out scenario when user may want to delete current branch — it's really weird case, so I just replaced taking attempt to execute invalid operation with localizable error message. Another possible improvement is to display branches differently depending on their status (current/merged/unmerged). How it could look? KindDragon closed this Jul 19, 2012 PKRoma pushed a commit to PKRoma/gitextensions that referenced this issue Aug 20, 2014 vcpp https://confluence.atlassian.com/fishkb/git-repository-indexing-fails-because-it-cannot-delete-the-branch-which-you-are-currently-on-336756945.html Error removing local branch: [error: Cannot http://www.webbykat.com/2012/04/git-commands-roundup-renaming-and-deleting-branches delete the branch 'the_branch_name' which you are currently on.] com.atlassian.utils.process.ProcessException: While executing: "git branch -D the_branch_name " in [/opt/fisheye/FISHEYE_INST/var/cache/REPO_NAME/clone] at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:262) at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:254) at com.atlassian.fisheye.git.GitScanner.removeLocalBranch(GitScanner.java:225) at com.atlassian.fisheye.git.GitScanner.fetchLatest(GitScanner.java:202) cannot delete at com.atlassian.fisheye.dvcs.DvcsScanner.updateClone(DvcsScanner.java:153) at com.atlassian.fisheye.dvcs.DvcsScanner.updateLocalRepoCache(DvcsScanner.java:140) at com.cenqua.fisheye.rep.BaseRepositoryScanner.ping(BaseRepositoryScanner.java:175) at com.cenqua.fisheye.rep.BaseRepositoryEngine.doSlurp(BaseRepositoryEngine.java:92) at com.cenqua.fisheye.rep.RepositoryEngine.slurp(RepositoryEngine.java:382) at com.cenqua.fisheye.rep.ping.OneOffPingRequest.doRequest(OneOffPingRequest.java:28) at com.cenqua.fisheye.rep.ping.PingRequest.process(PingRequest.java:58) at com.cenqua.fisheye.rep.RepositoryHandle.processPingRequests(RepositoryHandle.java:198) at com.cenqua.fisheye.rep.RepositoryHandle.access$100(RepositoryHandle.java:50) at com.cenqua.fisheye.rep.RepositoryHandle$2.run(RepositoryHandle.java:156) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: com.atlassian.utils.process.ProcessException: Non-zero exit code: 1 at cannot delete the com.atlassian.utils.process.PluggableProcessHandler.complete(PluggableProcessHandler.java:83) at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:308) at com.atlassian.utils.process.ExternalProcessImpl.execute(ExternalProcessImpl.java:351) at com.atlassian.fisheye.dvcs.client.DvcsContext.executeCommand(DvcsContext.java:259) Cause FishEye is not aware of some commits that have been deleted from one of the repositories. The repository can be identified from the path in the error message, for example in the above stacktrace, the repository isREPO_NAME. Resolution A re-clone and re-index of the repository is required. This can be done by performing the following: Navigate to Administration >> Repository Settings >> Repositories Select the repository that is affected to bring up the repository Summary Page Select Maintenance on the left. Next to Re-clone and Re-index, click on the Start
are some useful commands for getting the job done. Note: In all examples below, old_branch should be replaced with the name of the branch you want to delete, and new_branch should be replaced with the new name you want to use. Renaming branches If an old branch needs a new name, this command will rename it locally: git branch -m old_branch new_branchThe new branch won't show in github.com yet. To get it there, push to the new branch like so: git push origin new_branchThe new branch will now show in github.com, but the old branch will still be there as well. Both branches will have the commit history. Deleting branches Ready to get rid of a branch entirely? Check to see if it exists both locally and remotely first. You can see what exists remotely by visiting github.com, and what exists locally by typing git branch. If you've just renamed a branch, you'll see the old branch remotely but not locally. Deleting branches locally Here's the command to delete your branch locally: git branch -d old_branchYou may get this error when you use it: error: Cannot delete the branch 'old_branch' which you are currently on.This means that you're working off that branch already, and need to check out or create a new branch first. Once you've done that, you can run git branch -d old_branch again. Deleting branches remotely To delete a branch remotely, run this command: git push origin :old_branchDon't forget the colon -- that's what differentiates this from a normal push command and tells Git to clear the branch out. As documented at Matthew Brett's post, you won't be able to delete your default branch, normally called "master," until you make another branch the default. Once you've updated this at github.com (see below), you can run this command again. Changing the default branch The default branch is the one that comes up when you visit your repository at github.com. It's the first branch you created. If you frequently use a branch other than this one, it can be an annoyance. Changing it is easy: Open your repository at github.com. Click "Admin" -- near the top of the page, middle of the screen. Under the "Options" tab, change the default branch to whichever branch you'd like. There is no Save button; your changes are automatically saved. As noted above, you can't delete your default branch, so the steps above are necessary if you want to get rid of the first branch you created. Topics:Git, Command Line