On 2018-03-12, at 4:11 AM, Frank Röhm <francwal...@gmail.com> wrote:

> Hallo
> 
> sometimes it happens to me, that I clone a repo from my github account and do 
> some little but unnecessary changes, just to play a bit.  
> I want to discard them all now and surely I don't want to do any merge. I 
> just want to reset the local repo to the actual online state.
> The only easy way I know is to delete the whole local repo and clone it again.
> But this seems a very rough way to do it, git can do better, I know, but how?
> 
> I have to say that I am "coming from svn", where all is so much easier ;)
> 
> Thank for hints.
> 
> frank

There are two different ways to do this in git. Well, two ways that I know of.

The plan ahead method: make a new branch, and do anything that you want on the 
new branch. If you are playing around with more than one original branch, you 
may need to make more than one new branch.

With this method, cleanup is simple: delete the branches that you created.

The recovery method: the "git reset" command. "Reset" has the job of moving the 
branch pointers. The manual page is extremely confusing, but the bottom line is 
this: reset is used to move a branch pointer to a new location in the tree. 
This allows you to move the pointers back to where they were when you first 
cloned the repo. "-Hard" is the variant of reset that says, "throw away 
anything done, and make it look exactly like it was at the specified SHA".


---
Entertaining minecraft videos
http://YouTube.com/keybounce

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to