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?

Atrahasis
  • 3,060
  • 4
  • 13
  • 36
Ashraf.Shk786
  • 570
  • 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,042,979
  • 435
  • 3,649
  • 4,283
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
  • 18,701
  • 13
  • 79
  • 158