Ce diaporama a bien été signalé.
Le téléchargement de votre SlideShare est en cours. ×

Introduction to Git Version Control System

Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Publicité
Chargement dans…3
×

Consultez-les par la suite

1 sur 41 Publicité

Plus De Contenu Connexe

Similaire à Introduction to Git Version Control System (20)

Publicité

Plus par Oleksandr Zaitsev (11)

Plus récents (20)

Publicité

Introduction to Git Version Control System

  1. 1. Practical Introduction to Version Control Systems, Git, and GitHub
  2. 2. Goals 1. Understand what are VCS and why we need them 2. Learn to use Git understand the basic workflow: add, commit, push 3. Explore the main functionality of GutHub: repositories, issues, pull requests, etc.
  3. 3. Search Term Popularity (according to Google Trends) 0 25 50 75 100 Git GitHub Mercurial SVN March 2020April 2005
  4. 4. Starting from today, you will be required to use Git for all your assignments and projects You will be submitting them as GitHub repositories. 🙀 😱
  5. 5. Chapter 1. The Intuition Behind Version Control Systems (VCS)
  6. 6. Version 1Version 1 int factorial(int n) { int prod = 1; for (int k = 2; k <= n; ++k) { prod *= k; } return prod; }
  7. 7. Version 1Version 2 Version 1 int factorial(int n) { if (n == 0) return 1; return n * factorial(n - 1); }
  8. 8. Version 1Version 3 Version 2 Version 1 int factorial(int n) { return (n == 0) ? 1 : n * factorial(n - 1); }
  9. 9. Version 1 Version 3 Version 2 Version 1 int factorial(int n) { if (n == 0) return 1; return n * factorial(n - 1); }
  10. 10. Working Together on a Same Project
  11. 11. Version 3 Version 2 Version 1 Remote ServerOleks’ Computer Steven’s Computer
  12. 12. Version 3 Version 2 Version 1 Remote ServerOleks’ Computer Steven’s Computer Version 3 Version 2 Version 1 push
  13. 13. Version 3 Version 2 Version 1 Version 3 Version 2 Version 1 Version 3 Version 2 Version 1 Remote ServerOleks’ Computer Steven’s Computer pull
  14. 14. Version 3 Version 2 Version 1 Version 4 Version 3 Version 2 Version 3 Version 2 Version 1 Remote ServerOleks’ Computer Steven’s Computer Version 1
  15. 15. Version 3 Version 2 Version 1 Version 4 Version 3 Version 2 Version 4 Version 3 Version 2 Remote ServerOleks’ Computer Steven’s Computer Version 1Version 1 push
  16. 16. Version 4 Version 3 Version 2 Version 4 Version 3 Version 2 Version 4 Version 3 Version 2 Remote ServerOleks’ Computer Steven’s Computer Version 1Version 1 pull Version 1
  17. 17. Chapter 2. A Closer Look at Git Workflow
  18. 18. Initializing an Empty Git Repository and Connecting it to the Remote Repository
  19. 19. Oleks’ Computer Working Directory
  20. 20. Oleks’ Computer Working Directory Staging Area Local Repository git init Initializing a local Git repository
  21. 21. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository git remote add origin git@github.com:olekscode/GitPractice.git Registering a remote repository and assigning it a name “origin”
  22. 22. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository git remote add origin git@github.com:olekscode/GitPractice.git Registering a remote repository and assigning it a name “origin” Name URL
  23. 23. Making Changes and Pushing them to the Remote Repository
  24. 24. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository
  25. 25. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository Changing files inside a working directory
  26. 26. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository add Adding changes to the staging area (staging changes) git add main.c queue.h queue.c Files that were modified
  27. 27. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository commit Committing staged changes to the local repository git commit -m “Implemented the factorial function” Commit message that describes the changes “m” stands for “message"
  28. 28. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository push Pushing changes to the remote repository git push origin Name of the remote repository
  29. 29. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository add commit push git add main.c queue.h queue.c git commit -m “Implemented the factorial function” git push origin
  30. 30. Pulling Changes From the Remote Repository
  31. 31. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository Remote repository contains some changes that we don’t have
  32. 32. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository Fetching changes Into the local repository fetch git fetch origin Name of the remote repository
  33. 33. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository merge Integrating the fetched changes into the working directory git merge FETCH_HEAD Temporary reference to what has just been fetched
  34. 34. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository pull git pull origin Name of the remote repository You can fetch changes and then merge them using a single command “git pull”
  35. 35. Cloning the Existing Repository
  36. 36. Remote ServerOleks’ Computer Remote Repository Repository already exists on a remote server but you don’t have it on your computer
  37. 37. Remote ServerOleks’ Computer Working Directory Staging Area Local Repository Remote Repository clone git clone git@github.com:olekscode/GitPractice.git SSH or HTTPS link to the remote repository Cloning the existing repository onto your computer

×