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?

Mouloud85
  • 3,826
  • 5
  • 22
  • 42
Ashraf.Shk786
  • 618
  • 1
  • 11
  • 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,262,500
  • 529
  • 4,410
  • 5,250
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,824
  • 17
  • 99
  • 186