git - Going back to a previous commit in Gitkraken -


my programming partner , i, being new git , gitkraken, made mistakes, did pushes pulls , commits in wrong order, , got things bungled up. go snapshot several commits back, , manually compare current state of code. command along lines of

"take working directory state this historic commit" or better yet, "give me contents of this historic commit different working directory, name"

the options given me don't way, exactly. see "reset master commit" in several flavors, none of titles convince me i'm going @ previous state without damaging path current state. missing something? best way i'm trying do?

i suggest tu use git reflog, command contains local history of commits , changes, log see events local repo.

after finding exact commit want recover, can set commit starting point git reset --soft head@{n}

what --soft

does not touch index file or working tree @ (but resets  head <commit>, modes do). leaves changed files "changes committed", git status put it. 

after this, you'll have changes in stage area, can either decide if commit them again or change something.

i'd suggest read this section git's book , specially this section undoing things.

ps. extra, can use git reset many times want, because commands use saved in git reflog , because of that, if don't want to, can undo too.

hope helps


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -