1

I'm working in a local repository. I do not want to change anything in the repository, just retrieve an older version

Once I located the hash of a previous checkpoint, how can I get the file, how it was back then?

Do I have to clone, branch and delete after I got it?

2
  • git stash your local repository to retrieve them later if needed, then git branch to retrieve the branch you want, is the answer you're looking for similar to this? Commented Oct 7, 2018 at 18:18
  • @YousefAl-Hadhrami: no, that would change something in the repository. Commented Oct 7, 2018 at 18:33

1 Answer 1

1

You can retrieve an older version of a file without changing anything in your repository by giving a commit hash and file name to git show:

git show <hash>:<file>

For example

git show 842c6dcc:scp/scp.c

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.