git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Overwrite master
@ 2008-12-02 16:10 Nicholas Wieland
  2008-12-02 16:32 ` Peter Harris
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Wieland @ 2008-12-02 16:10 UTC (permalink / raw)
  To: git

Hi *,
I need to overwrite my master branch with another branch. I've already  
created a backup branch of my master.
I tried a merge but it's just too big to handle, and I don't really  
care about what's in my master now.
The reason I want to do something like this is to be able to branch  
directly from my master in the future and merge back smaller branches  
(basically what I didn't do this time ...) instead of trying to merge  
back a huge one. This time I've used git like I've used svn, my bad,  
very stupid thing ...
Hope my question is clear.

TIA,
   ngw

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Overwrite master
  2008-12-02 16:10 Overwrite master Nicholas Wieland
@ 2008-12-02 16:32 ` Peter Harris
  2008-12-02 20:09   ` Nicholas Wieland
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Harris @ 2008-12-02 16:32 UTC (permalink / raw)
  To: Nicholas Wieland; +Cc: git

On Tue, Dec 2, 2008 at 11:10 AM, Nicholas Wieland wrote:
> Hi *,
> I need to overwrite my master branch with another branch. I've already
> created a backup branch of my master.

While on master,
"git reset --hard <newbranch>"

Or while on a different branch,
git branch -D master
git branch master <newbranch>

Peter Harris

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Overwrite master
  2008-12-02 16:32 ` Peter Harris
@ 2008-12-02 20:09   ` Nicholas Wieland
  2008-12-02 20:28     ` Peter Harris
  0 siblings, 1 reply; 4+ messages in thread
From: Nicholas Wieland @ 2008-12-02 20:09 UTC (permalink / raw)
  To: Peter Harris; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

Il giorno 02/dic/08, alle ore 17:32, Peter Harris ha scritto:

> On Tue, Dec 2, 2008 at 11:10 AM, Nicholas Wieland wrote:
>> Hi *,
>> I need to overwrite my master branch with another branch. I've  
>> already
>> created a backup branch of my master.
>
> While on master,
> "git reset --hard <newbranch>"
>
> Or while on a different branch,
> git branch -D master
> git branch master <newbranch>

That's what I tried.
Unfortunately I don't know where to go after:

ngw@slicingupeyeballs ~/zooppa$ git commit
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 444 and 25 different commit(s) each, respectively.
#
nothing to commit (working directory clean)

Do I have to push ? If I pull it tries to merge ...


Thanks a lot for your time,
   ngw


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2435 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Overwrite master
  2008-12-02 20:09   ` Nicholas Wieland
@ 2008-12-02 20:28     ` Peter Harris
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Harris @ 2008-12-02 20:28 UTC (permalink / raw)
  To: Nicholas Wieland; +Cc: git

On Tue, Dec 2, 2008 at 3:09 PM, Nicholas Wieland wrote:
> Il giorno 02/dic/08, alle ore 17:32, Peter Harris ha scritto:
>
>> On Tue, Dec 2, 2008 at 11:10 AM, Nicholas Wieland wrote:
>>>
>>> Hi *,
>>> I need to overwrite my master branch with another branch. I've already
>>> created a backup branch of my master.
>>
>> While on master,
>> "git reset --hard <newbranch>"
>
> That's what I tried.
> Unfortunately I don't know where to go after:
>
> ngw@slicingupeyeballs ~/zooppa$ git commit
> # On branch master
> # Your branch and 'origin/master' have diverged,
> # and have 444 and 25 different commit(s) each, respectively.
> #
> nothing to commit (working directory clean)

That means your tracking branch is different from your local branch, by a lot.

> Do I have to push ? If I pull it tries to merge ...

If you push, it will be denied (non-fast-forward).

If you force push, your state will be as you expect. Be aware that
you're creating trouble for everyone else who uses 'origin' if you
force push. Also be aware that you will be undoing any changes that
anyone else has pushed to origin in the mean time.

Basically, history is history. If you don't want to cause problems for
the other users of 'origin', you may have to live with history as it
is. You won't be able to overwrite master, although you will probably
try to be more careful in the future.

Peter Harris

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-12-02 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-02 16:10 Overwrite master Nicholas Wieland
2008-12-02 16:32 ` Peter Harris
2008-12-02 20:09   ` Nicholas Wieland
2008-12-02 20:28     ` Peter Harris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).