# Introduction to git - a powerful version control system ## block structure - Why git? - poll from registration - other points from our list - git installation hands on - git on the command line - navigate manipulate on cli - ls, pwd, cd, mv, rm, cp, mkdir, rmdir - short break (optional) - (like) try git on beamer (closed laptops) - try git would be 1.1 to 1.9 - init - status - add - commit - log (metadata only) - short break (optional) - hands on - created project - multiple commits - multiple files - diff - log (with patch) - wrap up hands on - problems that occurred - conclusion ## Why git? ### Why would you want to use a VCS, e.g. git? - Summary of answers to question from registration. - git helps you to keep an overview of a project. ### Thoughts from the net “Have you ever:” - Made a change to code, realised it was a mistake and wanted to revert back? - Lost code or had a backup that was too old? - Had to maintain multiple versions of a product? - Wanted to see the difference between two (or more) versions of your code? - Wanted to prove that a particular change broke or fixed a piece of code? - Wanted to review the history of some code? - Wanted to submit a change to someone else's code? - Wanted to share your code, or let other people work on your code? - Wanted to see how much work is being done, and where, when and by whom? - Wanted to experiment with a new feature without interfering with working code? In these cases, and no doubt others, a version control system should make your life easier. To misquote a friend: A civilised tool for a civilised age. by si618 at [https://stackoverflow.com/a/1408464](https://stackoverflow.com/a/1408464) ## git installation hands on [instructions](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) ### installation on ubuntu We will use the version from the git ppa: ```bash sudo apt-get install ppa-purge sudo add-apt-repository ppa:git-core/ppa sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install git ``` ### installation on windows - [Download](https://git-scm.com/download/win) - choose 64 bit - portable if you do not have admin rights - default install options look OK - Git Bash - Windows Explorer context menue has *Git Bash Here* and *Git GUI Here* options - Windows credential window will pop up when accessing remotes with authentication ### navigate and manipulate on cli - pwd - ls - cd - mv - rm - cp - mkdir - rmdir ### configure git ```bash git config --global user.name "Your Name" git config --global user.email "your.name@idiv.de" ``` - eventually additionally configuration for windows/linux/mac stuff - line break configuration done during install for windows - eventually mention difference global local ## short break (optional) ## show try git like tutorial on beamer (closed laptops) - try git would be 1.1 to 1.9 - create project directory - init - status - add - commit - log (metadata only) ## short break (optional) ## hands on - created project - multiple commits - multiple files - diff - log (with patch) - test this with a windows and mac machine to see things like editor, linebreaks, etc. ## wrap up hands on - problems that occurred - conclusion