0

Until now I've did some basic operations with git, and in this real working scenario, I need to have access to an older version of a specified file. My question is how to transform a previous commit version in a new branch. Is it possible? How?

dole doug
  • 34,070
  • 20
  • 68
  • 87

2 Answers2

4

If you want to create a new branch at a arbitrary commit and check it out, do:

git checkout -b name_of_your_new_branch <sha1 of the commit>
knittl
  • 246,190
  • 53
  • 318
  • 364
1

If you just wan the older version of a file, you can do:

git checkout <commit> -- file
manojlds
  • 290,304
  • 63
  • 469
  • 417