0

I want to fetch all the previous versions of a file (let's assume Abc.xml) that I've committed in Git.

Is there any way to do so? I am sure Git has versioning system and so what I feel that my older file versions can be available. Any suggestions?

Mouloud88
  • 3,438
  • 4
  • 18
  • 41
Ashraf.Shk786
  • 590
  • 1
  • 9
  • 23

2 Answers2

2

You can see the log of your file:

git log -- myFile

Or, for all branches:

gitk --all -- myFile

Then checkout (meaning replace in your current working tree) your file with any past version

git checkout <commit> <file>

Or simply see it with git show.

I was getting error as : object file is empty

Then check out:

Community
  • 1
  • 1
VonC
  • 1,129,465
  • 480
  • 4,036
  • 4,755
1

Yes, you can do:

git log Abc.xml

to get hashes of commits that change this file. Then, for each hash, you can show the change:

git show c0d235cae22540ef1bcd2a35dddd919166d45666

Most IDEs have this feature integrated as well. NetBeans has a very good interface to Git.

halfer
  • 19,471
  • 17
  • 87
  • 173