851-0585-04L – Modeling and Simulating Social Systems with MATLAB 19.05.2018 851-0585-04L – Modeling and Simulating Social Systems with MATLAB Lecture 2 – Let’s GIT started: local operations Karsten Donnay and Stefano Balietti Chair of Sociology, in particular of Modeling and Simulation © ETH Zürich | © ETH Zürich |
Let’s Git Started: local operations 19.05.2018 Let’s Git Started: local operations In this mini tutorial you will receive the basic knowledge to work with GIT in your local machine GIT is a great tool when combined with an online repository, but this is the topic of next week.
Let’s Git Started: local operations 19.05.2018 Let’s Git Started: local operations GIT is free, open source software. http://git-scm.com/ Works from GUI and from terminal (command-line) On the Lab machines you can launch it with: GIT Bash (Windows) git (Linux – command line only)
Let’s Git Started: command line ?!?? 19.05.2018 Let’s Git Started: command line ?!?? Don‘t panic! You need just three commands: (but you can learn more...) Change directory: cd List files in a directory: ls Create a new directory: mkdir <name_of_dir>
Let’s Git Started: initialization 19.05.2018 Let’s Git Started: initialization Open a terminal or GIT Bash. Set the language to English (if you like) Browse to the directory with the project template files. Initialize your first GIT repository $ export LANG=en_us $ cd /path/to/your/files/ $ git init
Let’s Git Started: introduction 19.05.2018 Let’s Git Started: introduction Introduce yourself to GIT.
Let’s Git Started: introduction 19.05.2018 Let’s Git Started: introduction Introduce yourself to GIT. $ git config --global user.name "Your Name" $ git config --global user.email i@me.com
Let’s Git Started: give GIT tasks 19.05.2018 Let’s Git Started: give GIT tasks Tell GIT which files you would like to track for changes. Take a snapshot (commit) of all tracked files $ git add file1 file2 $ git add . $ git commit –m “This is my first commit”
Let’s Git Started: do your job… 19.05.2018 Let’s Git Started: do your job… Do any modification to the content of the files. Get the update of the status of the repository $ git status Visualize the differences in the terminal. Visualize the differences in a GUI client $ git diff $ gitk ; git gui ; gitx (for MAC)
Some hints how to use GIT for your code 19.05.2018 Some hints how to use GIT for your code Commit often. Use appropriate commit messages. Do not rename the file names manually (use git mv) New files are not automatically indexed, must be added. Careful with git add . Rather choose the files: git add file1 Write a .gitignore file or use git ignore for files that you never want to commit (e.g. big datasets)
References Git Home Page: http://git-scm.com/ 19.05.2018 References Git Home Page: http://git-scm.com/ Git General Info: http://git-scm.com/about Github Home Page: https://github.com/ GitX (a gui for OS X): http://gitx.frim.nl/ Git in 5 minutes: http://www.fiveminutes.eu/a-case-for-git/ Git Book http://book.git-scm.com/