Re: Newbie: Restore messed up code from local or remote repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]