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

Re: Pull from one branch to another?

From
TLTony Luck <tony.luck@gmail.com>
Date
Sep 29, 2005, 17:52 UTC
Message-ID
<12c511ca0509291052108fa0a7@mail.gmail.com>
In-Reply-To
<433B84BD.8030003@pobox.com>
On 9/28/05, Jeff Garzik <jgarzik@pobox.com> wrote:
>         $ git checkout -f sky2
...
>         $ git checkout -f upstream
...
>         $ git checkout -f ALL

Those "-f" arguments to git checkout shouldn't be needed, and may eventually cause a problem. The "-f" option doesn't quite work as "forcibly" as you might think it does because it ignores the index, and so doesn't do what you[1] expect with files that exist in the previously checked out tree, and not in the new tree ... it won't delete them, so there's a small risk that with the wrong git operation you may accidentally add them to the new branch.

In the sequence you described a simple "git checkout" should do the right thing ... and will be faster too.

-Tony
[1] well what *I* expected, and was part of a snafu I made earlier
Previous: Junio C Hamano
Message 7 of 7 in “Pull from one branch to another?”
  1. Jeff GarzikSep 29, 2005
  2. Junio C HamanoSep 29, 2005
  3. Use of the -f flag on checkoutAlan Chandler, Sep 29, 2005
  4. Matthias UrlichsSep 29, 2005
  5. Junio C HamanoSep 29, 2005
  6. Junio C HamanoSep 29, 2005
  7. Tony LuckSep 29, 2005

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.