version control with git
play

Version Control with Git Eileen K uhn, David Kunz, Sarah M uller, - PowerPoint PPT Presentation

Version Control with Git Eileen K uhn, David Kunz, Sarah M uller, Robin Roth KSETA Doktorandenworkshop, 23.07.2014 Jul. 23 rd 2014 0 Eileen K uhn, David Kunz, Sarah M uller, Robin Roth - Version Control with Git KSETA


  1. Version Control with Git Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth KSETA Doktorandenworkshop, 23.07.2014 Jul. 23 rd 2014 0 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014 KIT – University of the State of Baden-Wuerttemberg and www.kit.edu National Research Center of the Helmholtz Association

  2. Plead guilty! It’s easy to copy digital content, so why not re-create it over and over again? Jul. 23 rd 2014 1 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  3. Plead guilty! It’s easy to copy digital content, so why not re-create it over and over again? “One of these folders must contain the latest version . . . ” Jul. 23 rd 2014 1 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  4. Plead guilty! It’s easy to copy digital content, so why not re-create it over and over again? “Here is the latest version of the proposal/paper/report.” — “Thanks.” “One of these folders must contain the latest version . . . ” Jul. 23 rd 2014 1 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  5. Obvious disadvantages No meta data about what was changed when by whom You lose track of what’s going on You cannot easily roll-back to a working state Poor solution for collaboration Jul. 23 rd 2014 2 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  6. Version control Track files Record ( commit ) changes Share changes with others Roll-back to an earlier state Implicit backup Jul. 23 rd 2014 3 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  7. Why Git? De-facto standard for open source software Probably the fastest version control system out there GitHub: web based collaboration platform Works well both with central and distributed repositories Easy to learn Jul. 23 rd 2014 4 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  8. Git Basics Jul. 23 rd 2014 5 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  9. Configuration Tell git who you are $ git config --global user.name <name> $ git config --global user.email <email> Configure auto correct for git commands $ git config --global help.autocorrect 1 Use colors to show git information $ git config --global color.ui auto Jul. 23 rd 2014 6 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  10. Single User Workflow 1. Create a repository and a branch “master” $ git init 2. Create a commit 2.1 Add something to the commit $ git add README.txt 2.2 Perform the commit $ git commit -m "Added a README file" Jul. 23 rd 2014 7 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  11. Commits Everytime you make a change, you create a commit containing: added/removed lines in files a comment summarizing what was changed an author a date a checksum (SHA-hash) to identify the commit a reference to the previous state of your files (parent(s)) Jul. 23 rd 2014 8 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  12. Single User Workflow 1. Change something, and inspect the difference to the last commit $ vi README.txt $ git diff 2. Create a commit (as before) 2.1 Add some changes to the commit $ git add README.txt 2.2 Perform the commit $ git commit -m "Added project description" Jul. 23 rd 2014 9 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  13. Single User Workflow 1. Change something, and inspect the difference to the last commit $ vi README.txt $ git diff 2. Create a commit (as before) 2.1 Add some changes to the commit $ git add README.txt 2.2 Perform the commit $ git commit -m "Added project description" Jul. 23 rd 2014 9 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  14. Single User Workflow 1. Change something, and inspect the difference to the last commit $ vi README.txt $ git diff 2. Create a commit (as before) 2.1 Add some changes to the commit $ git add README.txt 2.2 Perform the commit $ git commit -m "Added project description" Jul. 23 rd 2014 9 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  15. How to commit Small logical units Several times an hour Check the status before committing Write descriptive commit messages and keep 50/72 limits ⇒ Allows you to retrace your steps Jul. 23 rd 2014 10 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  16. Branching Keep master branch free from “questionable” code Working on independent features at the same time Trying incompatible changes Quick and dirty work without changing the master branch Cheap, instant and easy Create and destroy often Integral part of a typical Git workflow Jul. 23 rd 2014 11 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  17. Branching Create two branches from master $ git checkout master $ git checkout -b featureA $ ...change & commit something $ git checkout master $ git checkout -b featureB $ ...change & commit something Jul. 23 rd 2014 12 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  18. Branching Create two branches from master $ git checkout master $ git checkout -b featureA $ ...change & commit something $ git checkout master $ git checkout -b featureB $ ...change & commit something Jul. 23 rd 2014 12 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  19. Branching Create two branches from master $ git checkout master $ git checkout -b featureA $ ...change & commit something $ git checkout master $ git checkout -b featureB $ ...change & commit something Jul. 23 rd 2014 12 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  20. Branching Create two branches from master $ git checkout master $ git checkout -b featureA $ ...change & commit something $ git checkout master $ git checkout -b featureB $ ...change & commit something Jul. 23 rd 2014 12 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  21. Branching Create two branches from master $ git checkout master $ git checkout -b featureA $ ...change & commit something $ git checkout master $ git checkout -b featureB $ ...change & commit something Jul. 23 rd 2014 12 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  22. Branching Switch back to master branch $ git checkout master Merge your changes into master $ git merge featureA # fast forward $ git merge --no-ff featureA # $ git merge featureB # merge Delete merged branches $ git branch -d featureA featureB Jul. 23 rd 2014 13 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  23. Branching Switch back to master branch $ git checkout master Merge your changes into master $ git merge featureA # fast forward $ git merge --no-ff featureA # $ git merge featureB # merge Delete merged branches $ git branch -d featureA featureB Jul. 23 rd 2014 13 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  24. Branching Switch back to master branch $ git checkout master Merge your changes into master $ git merge featureA # fast forward $ git merge --no-ff featureA # $ git merge featureB # merge Delete merged branches $ git branch -d featureA featureB Jul. 23 rd 2014 13 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  25. Branching Switch back to master branch $ git checkout master Merge your changes into master $ git merge featureA # fast forward $ git merge --no-ff featureA # $ git merge featureB # merge Delete merged branches $ git branch -d featureA featureB Jul. 23 rd 2014 13 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

  26. Branching Switch back to master branch $ git checkout master Merge your changes into master $ git merge featureA # fast forward $ git merge --no-ff featureA # $ git merge featureB # merge Delete merged branches $ git branch -d featureA featureB Jul. 23 rd 2014 13 Eileen K¨ uhn, David Kunz, Sarah M¨ uller, Robin Roth - Version Control with Git KSETA Doktorandenworkshop, 23.07.2014

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend