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 question
Moderators: hgm, Dann Corbit, Harvey Williamson
-
lucasart
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
git question
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
git checkout commit_hashlucasart 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
-
lucasart
- Posts: 3232
- Joined: Mon May 31, 2010 1:29 pm
- Full name: lucasart
Re: git question
Thanks. And "git checkout HEAD" to come back?mar wrote:git checkout commit_hashlucasart 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
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
I guess git checkout master, but HEAD may work too.lucasart wrote: Thanks. And "git checkout HEAD" to come back?
EDIT: of course unless you are working on a different branch