1. Open Terminal.
2. Make HelloWorld folder in your Desktop.
3. cd HelloWorld
4. Create hello.c file.
---------------------------------
#include studio.h
main()
{
printf();
}
---------------------------------
5. Initialise git.
git init
6. Check the git status.
git status
7. Add hello.c to your git.
git add hello.c
8. Commit your file to git.
git commit -m "hello.c created"
9. Check the log.
git log
10. Make some changes to your hello.c.
---------------------------------
#include studio.h
main()
{
printf("Learning to use git.");
}
---------------------------------
11. Commit your file.
git commit -m "printf argument added"
12. Check the difference in different revisions.
git diff
13. To check the difference between latest and the last revision.
git diff HEAD^...HEAD
14. Delete current hello.c file from your HelloWorld folder and retrieve the last commited file.
git checkout hello.c
No comments :
Post a Comment