From 94cce084bdc1dbd0e8db9bfd1edacd2695e221e0 Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Wed, 23 Sep 2020 18:54:56 -0500 Subject: [PATCH] final commit --- Readme.md | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 Readme.md diff --git a/Readme.md b/Readme.md new file mode 100644 index 0000000..b4707d7 --- /dev/null +++ b/Readme.md @@ -0,0 +1,96 @@ +# Readme # +This a repository example to practice the Git basic commands. + +# First commit # +The first commit is the creation of the =file-a.md= file and some lines of code. + +Then the repository will be enable by + +``` shell +$ git init +``` + +after that our first file has been created and will be filled with the next lines of code using the =echo= command or =Vim= editor: + +``` shell +vi file-a.md +``` + +its contents is: + +``` shell +Line 1 +Line 2 +Line 3 +``` + +to quit =Vim= editor use =:wq!= in command mode (pressing first the ESC key) + +Then, we have to add the file we want to track by =git add = command: + +``` shell +$ git add file-a.md +``` + +To finalize the process, we have to use the =git commit= command: + +``` shell +$ git commit -m "first commit" +[master (root-commit) b441ef4] first commit + 1 file changed, 3 insertions(+) + create mode 100644 file-a.md +``` + +the output from shell should be similar to code section above. Otherwise, you must provide your credentials as a new Git[^1] user with + +``` shell +$ git config --global user.name "Mona Lisa" +$ git config --global user.email "my_email@domain.com" +``` + +# Second commit # +After the first commit, we can make some modifications to =file-a.md= file: + +``` shell +Line 0 +Line 1 +Line 2 +``` + +then, following the same procedure create and stage your second commit: + +``` shell +$ git status +On branch master +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: file-a.md + +$ git add file-a.md +$ git commit -m "second commit" +[master 5fdc115] second commit + 1 file changed, 1 insertion(+), 1 deletion(-) +``` + +# Difftool # +To compare to commits, in this case our only commits, we will use the =difftool= command + +``` shell +$ git difftool b441ef4 +``` +here the number =b441ef4= is the commit code number. + +A more simple way to observe what modifications on the repository is by using =git show= command + +``` shell +$ git show +``` + +You can observe the log by using: + +``` shell +$ git log --graph --pretty +``` + +[^1]: Don't forget to run Git Bash or powerShell as Admin user on Windows OS