1

lets say I have a file, and lets call it "A.java".

....I don't have any hash tag ids / etc... I just want to go back to the file in the state before I screwed it up .

jayunit100
  • 17,388
  • 22
  • 92
  • 167

3 Answers3

3

git reset --hard will reset all files in the repository back to their state. git checkout A.java will reset just that file.

Jim Deville
  • 10,632
  • 1
  • 37
  • 47
3

git checkout -- <filename>

this will checkout your file to the master repository.

Check this out for more information

Difference between "git checkout <filename>" and "git checkout -​- <filename>"

Community
  • 1
  • 1
TheOneTeam
  • 25,806
  • 45
  • 116
  • 158
1
git checkout -- A.java
git pull #if you need to pull changes from the remote.

This assumes you haven't already tried to pull and are in the middle of a merge.

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406