Articles → GIT → Checkout Operation In GIT
Checkout Operation In GIT
What Does Checkout Mean?
Example
- Create an empty text file ‘1.txt’.
- Add ‘1.txt’ in git repository using the following command
Git add 1.txt
Git commit 1.txt -m “Committing 1.txt”
Click to Enlarge
Click to Enlarge
- Modify “1.txt” and add following text
Click to Enlarge
- Commit the changes using the commit command
Git commit 1.txt -m “Commit 1.txt 2nd time”
Click to Enlarge
Click to Enlarge
- If we want to switch to previous commit then we can use checkout command
Git checkout f25908abe8eec7fa4e417573e0d603217b392a78
Click to Enlarge
Click to Enlarge
Click to Enlarge
Git checkout 95a6eeca9b742ba406ca611eac6bf6a30e98b4ef