threads / discuss / 17969

how to reset to remote repo

Subject: how to reset to remote repo

## tl;dr

6 messages between Feb 23, 2009 and Feb 23, 2009.

replies: 5people: 3as markdown or json

bill lam· Feb 23, 2009, 10:55 UTC · lore

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· Feb 23, 2009, 12:14 UTC · re: bill lam · lore

Re: how to reset to remote repo

git reset --hard HEAD
-- BR, Dilip
On Mon, Feb 23, 2009 at 4:25 PM, bill lam <cbill.lam@gmail.com> wrote:
Show 17 quoted lines
> 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· Feb 23, 2009, 12:49 UTC · re: bill lam · lore

Re: how to reset to remote repo

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· Feb 23, 2009, 14:57 UTC · re: Sitaram Chamarty · lore

Re: how to reset to remote repo

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· Feb 23, 2009, 15:50 UTC · re: bill lam · lore

Re: how to reset to remote repo

On 2009-02-23, bill lam <cbill.lam@gmail.com> wrote:
Show 9 quoted lines
> 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· Feb 23, 2009, 23:19 UTC · re: Sitaram Chamarty · lore

Re: how to reset to remote repo

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 王維  送別
    山中相送罷  日暮掩柴扉  春草明年綠  王孫歸不歸

← back to recent threads