# git basics ## for beginner-level git users notes: - if you have questions ask them right away - hand out cheat sheets later, no need to write stuff down
## objectives - teach you to fish - hands-on experience - use version control! - collaborate!
## about me - scientific computing support @ idiv since 2014 - happy git user since 2010 > There will never be a better version control system than git. > > -- Christian Krause, Chemnitz 2017
## about today be able to ... 1. use git in **ALL** your projects 2. collaborate with each other ... that is mission accomplished. notes: - there is time for fancy stuff later - take a few weeks getting used to git - delay is good to grow your own experience - growing pain is how we learn
## about you ![people](img/people.jpg) name, job, git experience, why git?
## about git 1. **records changes to a repository** content, who, when, message 2. **best tool for the job** technical, usability, community notes: - the fact that content is organized in files and directories is only incidental - for git to be useful, content has to be text
# motivation > Why should I use git?
## motivation #1 ### avoid mess ![blah](img/draft_mess.png)
## motivation #1 ### want structure ![blah](img/gitk-pretty-history.png)
## motivation #2 ### throw-away playgrounds ![playground](img/motivation-throwaway-playground.svg) notes: - test stuff without interfering - throw away if garbage - integrate if good - switch back and forth - (done right) decision based on regression testing
## motivation #3 ### collaboration made easy > This text cuntains a typo. notes: - demo GitLab - [go to project](https://git.idiv.de/sc/edu/git-seminar) - check if typo still in master - edit - change **target branch** to create merge request - commit message: ``` fixes typo learn how to use a spell checker ```
## motivation #4 ### the creative use of git award #### goes to Michael Schilli ```yml videos: - id: '_3i5yVoTvCs' title: 'How to flip German pancakes' - id: 'brPfE66FC24' title: 'Tivo Stream Cooling Fan Replacement' ``` ```console $ youtube-sync -i videos.yml _3i5yVoTvCs: Unchanged brPfE66FC24: Updated OK ``` source: [Linux Magazin](http://www.linux-magazin.de/) 2018/01
## motivation #e ### use version control for # *everything* | common | less frequent | esoteric? | | ------------ |:---------------:| ---------------:| | software | presentation | youtube | | blog | paper / thesis | soundboard | | user config | task management | drinking games | notes: - if it doesn't support git don't use it
## motivation #a ### automation - software testing - build app and deploy to app store - put presentation on web server *(see advanced seminar)*
# let's get started notes: - git is simple and complex - git seems complex for 2 reasons: - you're unfamiliar with command line - there are a lot of choices - only X (TODO) theory pages - I'm gonna dumb it down for you - aka we'll stick to the simple parts
# [cheat sheet](https://idiv-biodiversity.github.io/git-cheat-sheet/)
## command line - Ellen Ripley uses command line - Chuck Norris uses command line
## os packages **Linux:** bash and git **Mac:** bash and git **Windows:** cmder
## setup ```bash # identity git config --global user.name 'Jane Doe' git config --global user.email 'jane.doe@feminism.org' # colors git config --global color.ui auto # aliases git config --global alias.unstage 'reset HEAD --' git config --global alias.lol \ 'log --graph --decorate --oneline --all' ```
## my project demo notes: - git init hello - README.md - LICENSE - TODO really talk about licenses? I should, because it's important, but it takes time away from other things ... - src/hello.py
## web apps - GitHub demo - GitLab demo

EOF

fork me