* Broken Repo
@ 2012-05-07 3:36 Joe Zim
2012-05-07 7:39 ` Marcus Karlsson
2012-05-07 7:49 ` Jeff King
0 siblings, 2 replies; 4+ messages in thread
From: Joe Zim @ 2012-05-07 3:36 UTC (permalink / raw)
To: git
Hi, I'm new here. I'm using Github right now. I have a repository there
and a local copy on my Windows 7 PC. I made a change, committed it, then
attempted to push it. I got a strange error that I can't remember.
Anyway, after several attempts I decided to just delete the local
repository, restore it from github and try again later. I realize now
that there were other ways this should have been handled, but right now
it doesn't matter. I can't figure out how to restore a copy from Github
and make this renewed repo the master branch. Can anyone give me a
detailed, step by step answer please?
Thanks,
Joseph Zimmerman
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Broken Repo
2012-05-07 3:36 Broken Repo Joe Zim
@ 2012-05-07 7:39 ` Marcus Karlsson
2012-05-07 7:49 ` Jeff King
1 sibling, 0 replies; 4+ messages in thread
From: Marcus Karlsson @ 2012-05-07 7:39 UTC (permalink / raw)
To: Joe Zim; +Cc: git
On Sun, May 06, 2012 at 10:36:53PM -0500, Joe Zim wrote:
> Hi, I'm new here. I'm using Github right now. I have a repository
> there and a local copy on my Windows 7 PC. I made a change,
> committed it, then attempted to push it. I got a strange error that
> I can't remember. Anyway, after several attempts I decided to just
> delete the local repository, restore it from github and try again
> later. I realize now that there were other ways this should have
> been handled, but right now it doesn't matter. I can't figure out
> how to restore a copy from Github and make this renewed repo the
> master branch. Can anyone give me a detailed, step by step answer
> please?
>
> Thanks,
> Joseph Zimmerman
You deleted the local repository and want to clone it again from
GitHub right?
You can run 'git clone git@github.com:username/reponame.git' and
that should give you a new local repository cloned after the repository
on GitHub. Just replace username and reponame with the appropriate names
first and you should be up and running.
Marcus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Broken Repo
2012-05-07 3:36 Broken Repo Joe Zim
2012-05-07 7:39 ` Marcus Karlsson
@ 2012-05-07 7:49 ` Jeff King
2012-05-07 18:12 ` Joe Zim
1 sibling, 1 reply; 4+ messages in thread
From: Jeff King @ 2012-05-07 7:49 UTC (permalink / raw)
To: Joe Zim; +Cc: git
On Sun, May 06, 2012 at 10:36:53PM -0500, Joe Zim wrote:
> Hi, I'm new here. I'm using Github right now. I have a repository
> there and a local copy on my Windows 7 PC. I made a change, committed
> it, then attempted to push it. I got a strange error that I can't
> remember. Anyway, after several attempts I decided to just delete the
> local repository, restore it from github and try again later. I
> realize now that there were other ways this should have been handled,
> but right now it doesn't matter. I can't figure out how to restore a
> copy from Github and make this renewed repo the master branch. Can
> anyone give me a detailed, step by step answer please?
I don't quite understand your question. You deleted the original
repository, which I assume means you removed the whole working tree. So
can you not "git clone" the original repository again and redo your
work?
Or did you remove only the ".git" directory, leaving your modified
working tree in place? If that is the case, you probably want:
# turn your directory back into a git repository
cd $your_project
git init
# fetch the existing work again
git remote add origin $your_remote_url
git fetch
# now tell git that we are basing our branch on the upstream master.
# We must make sure not to use "--hard" here, because that would
# overwrite the working tree.
git reset origin/master
At this point you should be able to use "git status" to see your
changes, and commit as normal. You might also want to run:
git branch --set-upstream master origin/master
to make "git pull" work without any arguments. This setup is done
automatically by "git clone", but not by the manual init+fetch we did
above.
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Broken Repo
2012-05-07 7:49 ` Jeff King
@ 2012-05-07 18:12 ` Joe Zim
0 siblings, 0 replies; 4+ messages in thread
From: Joe Zim @ 2012-05-07 18:12 UTC (permalink / raw)
To: Jeff King; +Cc: git
Thanks for the reply guys. It's fixed now.
On 5/7/2012 2:49 AM, Jeff King wrote:
> On Sun, May 06, 2012 at 10:36:53PM -0500, Joe Zim wrote:
>
>> Hi, I'm new here. I'm using Github right now. I have a repository
>> there and a local copy on my Windows 7 PC. I made a change, committed
>> it, then attempted to push it. I got a strange error that I can't
>> remember. Anyway, after several attempts I decided to just delete the
>> local repository, restore it from github and try again later. I
>> realize now that there were other ways this should have been handled,
>> but right now it doesn't matter. I can't figure out how to restore a
>> copy from Github and make this renewed repo the master branch. Can
>> anyone give me a detailed, step by step answer please?
> I don't quite understand your question. You deleted the original
> repository, which I assume means you removed the whole working tree. So
> can you not "git clone" the original repository again and redo your
> work?
>
> Or did you remove only the ".git" directory, leaving your modified
> working tree in place? If that is the case, you probably want:
>
> # turn your directory back into a git repository
> cd $your_project
> git init
>
> # fetch the existing work again
> git remote add origin $your_remote_url
> git fetch
>
> # now tell git that we are basing our branch on the upstream master.
> # We must make sure not to use "--hard" here, because that would
> # overwrite the working tree.
> git reset origin/master
>
> At this point you should be able to use "git status" to see your
> changes, and commit as normal. You might also want to run:
>
> git branch --set-upstream master origin/master
>
> to make "git pull" work without any arguments. This setup is done
> automatically by "git clone", but not by the manual init+fetch we did
> above.
>
> -Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-07 18:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07 3:36 Broken Repo Joe Zim
2012-05-07 7:39 ` Marcus Karlsson
2012-05-07 7:49 ` Jeff King
2012-05-07 18:12 ` Joe Zim
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.