git question

Discussion of chess software programming and technical issues.

Moderators: hgm, Dann Corbit, Harvey Williamson

User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

git question

Post by lucasart »

I would like to compile an old version of my program. Basically I just want to go back to commit XYZ (of the master branch) and compile the source code as it was back then. But I don't want to commit any revert: so just a "goto commit XYZ", and "go back" once done.

How can I do that in git ? (simple solutions preferred, and command line only please)

Thank you
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
mar
Posts: 2552
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: git question

Post by mar »

lucasart wrote:I would like to compile an old version of my program. Basically I just want to go back to commit XYZ (of the master branch) and compile the source code as it was back then. But I don't want to commit any revert: so just a "goto commit XYZ", and "go back" once done.

How can I do that in git ? (simple solutions preferred, and command line only please)

Thank you
git checkout commit_hash
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: git question

Post by lucasart »

mar wrote:
lucasart wrote:I would like to compile an old version of my program. Basically I just want to go back to commit XYZ (of the master branch) and compile the source code as it was back then. But I don't want to commit any revert: so just a "goto commit XYZ", and "go back" once done.

How can I do that in git ? (simple solutions preferred, and command line only please)

Thank you
git checkout commit_hash
Thanks. And "git checkout HEAD" to come back?
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
mar
Posts: 2552
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: git question

Post by mar »

lucasart wrote: Thanks. And "git checkout HEAD" to come back?
I guess git checkout master, but HEAD may work too.
EDIT: of course unless you are working on a different branch