Skip to contentSkip to conversation

how to reset to remote repo

DISCUSSION bill lam 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore

bill lam

author
#0 lore raw

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?

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

git reset --hard HEAD

-- BR, Dilip

Quoted 17 lines · bill lam

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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to bill lam
Quoted 4 lines · bill lam

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 :-)

author
#3 lore raw
Quoted 4 lines · Sitaram Chamarty

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?

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

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.

author
#5 lore raw
Quoted 3 lines · Sitaram Chamarty

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.

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