My workflow is: I make commits to branch main on local, I push changes. I have automated merge on github and pull on serwer.
I want to restore some files how it was in second commit after init. How to do this?
My workflow is: I make commits to branch main on local, I push changes. I have automated merge on github and pull on serwer.
I want to restore some files how it was in second commit after init. How to do this?
The advantage of using version control systems like git
is that it captures the entire history and you can always go back to the code in a particular snapshot. To do this:
Find the code point in the history that you want to get the files from. Use git log
and likely with --all
to find the point in time with the sha identifier you want to get the files from. If the history is long, you might try git log --graph --decorate --all --oneline
Then you can checkout that point in time using git checkout SHAID
If you want to get back to this point in time frequently, you might add a tag at that point so you can get back easily: git tag MYTAG
After doing whatever you want, go back to the main branch tip again using git checkout main