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

Re: Copy branch into master

From
Tay Ray Chuan <rctay89@gmail.com>
Date
Nov 29, 2011, 12:49 UTC
Message-ID
<CALUzUxrxX7Av6OSb5qHMSCua-Y8dGdf8ux1yLoCwNJeXtd-kow@mail.gmail.com>
In-Reply-To
<20111128183616.GB29503@foghorn.codeweavers.com>
On Tue, Nov 29, 2011 at 2:36 AM, Andrew Eikum <aeikum@codeweavers.com> wrote:
Show 16 quoted lines
> On Mon, Nov 28, 2011 at 10:25:33AM -0800, Ron Eggler wrote:
>> Some time ago I created a DVT branch in my project and I have almost been
>> exclusively working in it. Now the time for some test deployment came and I
>> didn't have time to merge it all back into the master thus I gave out the
>> DVT branch version. Now I would like to copy exactly what I have in that
>> branch back into my master to have an exact copy in my master of what got
>> deployed with out any changes.
>> How can I do this?
>
> Couple options, depending on what you want:
>
> Rename DVT to master (similar to 'mv DVT master', including
> losing the contents of 'master'):
> $ git checkout --detach HEAD
> $ git branch -M DVT master
> $ git checkout master

It might not be wise to take the strict definition of rename = move (copy + delete). You will lose *all* your reflog associated with master. The old master is gone forever.

Resetting the branch is "safer". It's like pseudo-copying the branch. The reflog for both branches are still around. You can do this with

 # on master
 $ git reset --hard DVT
or
 # not on master
 $ git branch -f master dvt
-- 
Cheers,
Ray Chuan
Previous: Neal Kreitzinger
Message 7 of 7 in “Copy branch into master”
  1. Ron EgglerNov 28, 2011
  2. Andrew EikumNov 28, 2011
  3. Ron EgglerNov 28, 2011
  4. Andrew EikumNov 28, 2011
  5. Ron EgglerNov 28, 2011
  6. Neal KreitzingerDec 1, 2011
  7. Tay Ray ChuanNov 29, 2011

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.