Git scenarios

From $1

Since I am just begining using git : I will collect here scnearios where the git commands i needed were not entirely obvious. Here is one

How I do i reset or revert to a file to the last commit or even a commit several commits back.?

For eg I have a file "newtestcode.py" , which I am not happy with. I want to go back to the newtestcode,py from the previous ( or any other ) commit. I issue the command

git checkout sha1-of-the-desired-commit newtestcode.py

eg

git checkout a322c00f28f14aaad047dfcff422b7e947613af1 newtestcode.py

Also see this stackoverflow discussion

 

Tags:
 
Images (0)
 
Comments (0)
You must login to post a comment.