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,048
  • 21
  • 85
  • 157

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,442
  • 1
  • 34
  • 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
  • 24,336
  • 44
  • 110
  • 154
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
  • 64,006
  • 65
  • 247
  • 399