git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Git branch deletion not based on HEAD branch anymore

From
Javier Domingo Cansino <javierdo1@gmail.com>
Date
Apr 6, 2017, 20:31 UTC
Message-ID
<CALZVapk4zxn-DSdMdy2q-Z0KvsBvx4MCSB5UDVOaBrBvAqw_AA@mail.gmail.com>
Hello,

I have noticed that in the "latest" versions of git, `git branch -d branch` instead of refusing to delete a branch that hasn't been merged to HEAD, it now throws a warning and deleting the local branch if it's present in a remote.

Example: ```

> git branch -d command-runner
warning: deleting branch 'command-runner' that has been merged to
         'refs/remotes/origin/command-runner', but not yet merged to HEAD.
Deleted branch command-runner (was 1716ed5).
```

After diving in git blame for a while I have realized that "lately" refers to a commit done in 2009.

Because the change is over 7 years old, I will explain what is my use case.

The workflow I follow since I started with git is to start an exact replica of my working environment in a personal fork. Anything deleted locally is deleted remotely and viceversa. This allows me to move between work and home smoothly. I also use the default `git config push.default matching`

My typical day starts and ends pulling master from the central repo, and `git branch -d`-ing all the branches I have in local. git would delete the ones that have been merged, and leave alone the ones that have been not been merged. Then I rebase all my branches and push the new master and rebased branches. Because all my local branches track my personal repo, all of them get deleted if I execute my scripts.

I understand it's not possible / convenient anymore to go back, but would it be possible to have an option such as `--merged` to support the old usecase?

-- 
Javier Domingo Cansino
Next: Jeff King
Message 1 of 3 in “Git branch deletion not based on HEAD branch anymore”
  1. Javier Domingo CansinoApr 6, 2017
  2. Jeff KingApr 7, 2017
  3. Javier Domingo CansinoApr 7, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.