From: Ramkumar Ramachandra <artagnon@gmail.com>
To: gzoller <gzoller@hotmail.com>
Cc: git@vger.kernel.org
Subject: Re: Newbie: Restore messed up code from local or remote repository
Date: Fri, 12 Nov 2010 16:08:39 +0530 [thread overview]
Message-ID: <20101112103836.GB20053@kytes> (raw)
In-Reply-To: <1289550163511-5731540.post@n2.nabble.com>
Hi Greg,
gzoller writes:
> git checkout
> git pull -f /path/to/remote/repos
> git fetch -f /path/to/remote/repos
>
> None of the above did the trick. The two remote commands reported that
> everything was Already up-to-date! (even though I'd deleted a lot of local
> working files)
Yes, there's really nothing to download. Everything that needs to be
fetched has already been fetched :)
> What am I missing? How can I restore my previous state from last commit?
See `--hard` switch of `git reset`. Use with extreme caution.
To throw *everything* all your local work away and go back to the
state of the remote repository, switch to `master` branch and do `git
reset --hard origin/master` where `origin` is the name of your remote
and `master` is the name of your remote branch.
To reset to the last commit without looking at the remote, run `git
reset --hard`.
Note: Again, please understand what it's doing first; don't run it
blindly.
-- Ram
next prev parent reply other threads:[~2010-11-12 10:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 8:22 Newbie: Restore messed up code from local or remote repository gzoller
2010-11-12 10:38 ` Ramkumar Ramachandra [this message]
2010-11-12 12:46 ` Jan Hudec
2010-11-12 14:02 ` Santi Béjar
2010-11-12 16:50 ` gzoller
2010-11-12 16:57 ` Matthieu Moy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101112103836.GB20053@kytes \
--to=artagnon@gmail.com \
--cc=git@vger.kernel.org \
--cc=gzoller@hotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).