Consider a project management app that uses git at backend.
The new versions are always created using git add . followed by git commit.
For evaluation purposes,I want a way to get old version of a project stored in it,in such a way that entire directory contents are reverted to the specified commit.Also,after the evaluation,the contents must be reverted back to the latest version.
How can this be accomplished?
Extra info(might not be necessary):It is a web app for storing academic projects that runs on php,on a remote server,and accessed over a network.
This is one of the very basic features of
git:git checkout.changes your working directory match that branch or tag.
makes your current directory reflect the state of your repository when that commit happened. (Careful if you do this, you’ll be in “detached head” mode – you shouldn’t modify files in that state.)
You can also simply create a branch specifically for this “evaluation” and check it out in one operation:
When you’re done, just checkout the branch you were previously one and the working directory will be updated.
(And possibly
git branch -d evaluationif you don’t need that anymore.)