# how to reset to remote repo

6 messages from 2009-02-23 to 2009-02-23. Participants: bill lam, Dilip M, Sitaram Chamarty.
Thread: https://gitlist.dev/t/17969

## bill lam, 2009-02-23 10:55

Subject: how to reset to remote repo
Message-ID: <20090223105546.GA7425@b2j>
URL: https://gitlist.dev/e/20090223105546.GA7425%40b2j

```
I cloned some public git repos and made some local patches. Later I
pulled updates again and that merged with my patches. Now I want to
throw away my patches, how do I get a clean working repo that is a
100% clone of the remote repo?

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩285 張祜  集靈臺二首之二
    虢國夫人承主恩  平明騎馬入宮門  卻嫌脂粉污顏色  淡掃蛾眉朝至尊

```

## Dilip M, 2009-02-23 12:14

Subject: Re: how to reset to remote repo
Message-ID: <c94f8e120902230414v33d36acelc3dc39861646539a@mail.gmail.com>
URL: https://gitlist.dev/e/c94f8e120902230414v33d36acelc3dc39861646539a%40mail.gmail.com
In-Reply-To: <20090223105546.GA7425@b2j>

```
git reset --hard HEAD

-- BR, Dilip




On Mon, Feb 23, 2009 at 4:25 PM, bill lam <cbill.lam@gmail.com> wrote:
> I cloned some public git repos and made some local patches. Later I
> pulled updates again and that merged with my patches. Now I want to
> throw away my patches, how do I get a clean working repo that is a
> 100% clone of the remote repo?
>
> --
> regards,
> ====================================================
> GPG key 1024D/4434BAB3 2008-08-24
> gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
> 唐詩285 張祜  集靈臺二首之二
>    虢國夫人承主恩  平明騎馬入宮門  卻嫌脂粉污顏色  淡掃蛾眉朝至尊
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

```

## Sitaram Chamarty, 2009-02-23 12:49

Subject: Re: how to reset to remote repo
Message-ID: <slrngq56ql.q4m.sitaramc@sitaramc.homelinux.net>
URL: https://gitlist.dev/e/slrngq56ql.q4m.sitaramc%40sitaramc.homelinux.net
In-Reply-To: <20090223105546.GA7425@b2j>

```
On 2009-02-23, bill lam <cbill.lam@gmail.com> wrote:
> I cloned some public git repos and made some local patches. Later I
> pulled updates again and that merged with my patches. Now I want to
> throw away my patches, how do I get a clean working repo that is a
> 100% clone of the remote repo?

git reset --hard origin/master

This is a very simple question, and may be quicker on irc
:-)

```

## bill lam, 2009-02-23 14:57

Subject: Re: how to reset to remote repo
Message-ID: <20090223145722.GB7422@b2j>
URL: https://gitlist.dev/e/20090223145722.GB7422%40b2j
In-Reply-To: <slrngq56ql.q4m.sitaramc@sitaramc.homelinux.net>

```
On Mon, 23 Feb 2009, Sitaram Chamarty wrote:
> git reset --hard origin/master
> 
> This is a very simple question, and may be quicker on irc
> :-)

Does it always work?  For example if I already made several patches
interleaved with several fetch/update, or if I rebase to remove the
orgin/master?

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩286 張祜  題金陵渡
    金陵津渡小山樓  一宿行人自可愁  潮落夜江斜月裡  兩三星火是瓜州

```

## Sitaram Chamarty, 2009-02-23 15:50

Subject: Re: how to reset to remote repo
Message-ID: <slrngq5her.6l3.sitaramc@sitaramc.homelinux.net>
URL: https://gitlist.dev/e/slrngq5her.6l3.sitaramc%40sitaramc.homelinux.net
In-Reply-To: <20090223145722.GB7422@b2j>

```
On 2009-02-23, bill lam <cbill.lam@gmail.com> wrote:
> On Mon, 23 Feb 2009, Sitaram Chamarty wrote:
>> git reset --hard origin/master
>> 
>> This is a very simple question, and may be quicker on irc
>> :-)
>
> Does it always work?  For example if I already made several patches
> interleaved with several fetch/update, or if I rebase to remove the
> orgin/master?

I'm not sure why a rebase of any kind would remove a remote
brancg but you can always do 'git fetch' first if you
accidentally messed up origin/master.

```

## bill lam, 2009-02-23 23:19

Subject: Re: how to reset to remote repo
Message-ID: <20090223231928.GA7406@b2j>
URL: https://gitlist.dev/e/20090223231928.GA7406%40b2j
In-Reply-To: <slrngq5her.6l3.sitaramc@sitaramc.homelinux.net>

```
On Mon, 23 Feb 2009, Sitaram Chamarty wrote:
> I'm not sure why a rebase of any kind would remove a remote
> brancg but you can always do 'git fetch' first if you
> accidentally messed up origin/master.

Thanks. Incidentally I just found that I could git reset just before
my first patch and then git pull again.

-- 
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3
唐詩226 王維  送別
    山中相送罷  日暮掩柴扉  春草明年綠  王孫歸不歸

```
