How to undo the command "git reset HEAD ~ 1"?

1

I was trying to get back to the last committed commit, and nothing works anymore, I wanted to know if you have to undo the git reset command

    
asked by anonymous 28.02.2018 / 18:18

1 answer

2

After some research I found a very interesting material that helped me a lot, follow the link: link

1st Whenever there is a relevant change in your code, remember git commit:

Thanks to the good father I have the good practice of committing whenever a modification is made to the system, even though I have little practice with git, and I had the commit from the previous day where everything was working, except for some very irrelevant modifications. / p>

2nd undoing unwanted changes in git:

  • git checkout

"If I regret my last changes?"

"You can discard changes in your working directory by returning the state of your files to the last saved in the staging area."

Since it can be done from the id of your commit or from your files, examples:

  • git checkout id_commit
  • git checkout file
  • git checkout. (command executed)

    
01.03.2018 / 12:29