Introduction class to Git version contoller
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
Gerardo Marx Chávez-Campos 94cce084bd final commit 4 years ago
Readme.md final commit 4 years ago
file-a.md second commit 4 years ago

Readme.md

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

$ 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:

vi file-a.md

its contents is:

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 <file(s)>= command:

$ git add file-a.md

To finalize the process, we have to use the =git commit= command:

$ 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 Git1 user with

$ 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:

Line 0
Line 1
Line 2

then, following the same procedure create and stage your second commit:

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." 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

$ 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

$ git show

You can observe the log by using:

$ git log --graph --pretty

  1. Don't forget to run Git Bash or powerShell as Admin user on Windows OS ↩︎