Modeling and Simulating Social Systems with MATLAB Lecture 3 – Git Stefano Balietti, Olivia Woolley, Dirk Helbing Computational Social Science ETH Zürich
Announcement! We are hiring! We are looking for 1 or 2 student assistants with strong computational skills. Programming Languages: Javascript, Node.js (or willingness to learn them quickly) If interested contact your instructor Stefano Balietti in class or via email sbalietti@ethz.ch Modeling and Simulating Social Systems with MATLAB 2
Schedule of the course 21.09. Introduction to 28.09. MATLAB 05.10. Modeling overview 12.10. Flash Talks 19.10. Introduction to 26.10. social-science Working on 02.11. modeling and projects 09.11. simulations (seminar 16.11. thesis) 23.11. 30.12. 07.12. Handing in seminar thesis and giving a presentation 14.12. Modeling and Simulating Social Systems with MATLAB 3 3
Schedule of the course 21.09. Introduction to 28.09. MATLAB 05.10. Modeling overview 12.10. Project Proposals must be submitted before ! Flash Talks 19.10. Introduction to 26.10. social-science Working on 02.11. modeling and projects 09.11. simulations (seminar 16.11. thesis) 23.11. 30.12. 07.12. Handing in seminar thesis and giving a presentation 14.12. Modeling and Simulating Social Systems with MATLAB 4 4
Project Implementation of a model from the Social Science literature in MATLAB During the next two weeks: Form a group of two to four persons Choose a topic among the project suggestions (available on line) or propose your own idea Set up a GitHub repository for your group Complete the research proposal (It is the README file of your GitHub repository) 201 Mo 5 4- del
Research Plan Structure 1-2 (not more!) pages stating: Brief, general introduction to the problem How you abstract the problem with a model Fundamental questions you want to try to answer Existing literature, and previous projects you will base your model on and possible extensions. https://github.com/msssm/interesting_projects/wiki Research methods you are planning to use 201 Mo 6 4- del
Research Plan Upon submission, the Research Plan can: be accepted be accepted under revision be modified later on only if change is justified (create new version) Talk to us if you are not sure Final deadline for signing-up for a project is: 18 October 2015 (midnight) 201 Mo 7 4- del
Deadlines and Dates Deadline for project proposals: Monday 18 October 2015 at midnight Deadline for project reports: Tuesday 11 December 2015 at midnight Oral project presentations: Wednesday 14 December to 16 December 2015 Modeling and Simulating Social Systems with MATLAB 8 8
Revision Control Revision (or version) control systems are software aimed at managing changes to files (such as source code files) Version control software: Traditional/centralized: CVS, Subversion (SVN) Modern/distributed: Bazaar, Mercurial, Git We will use Git for managing the research proposals, source code, and final reports Modeling and Simulating Social Systems with MATLAB 9 9
Distributed revision control / source code management Initially designed and developed by Linus Torvalds Git repositories (“code bases”) consist of a history of commits (“changes”) Every (local) instance of a repository has the complete history Supported by popular hosting sites such as GitHub and Bitbucket Modeling and Simulating Social Systems with MATLAB 10
Collaboration and Branches Modeling and Simulating Social Systems with MATLAB 11 11
Course repositories The GitHub organization for the course: https://github.com/msssm Links to projects of previous semesters: https://github.com/msssm/interesting_projects/wiki Template for project repository: https://github.com/msssm/project_template Modeling and Simulating Social Systems with MATLAB 12 12
Using Git On the command line, Git is used by calling the git command There are many graphical user interfaces for different operating systems There are Git plugins for development environments such as Eclipse Modeling and Simulating Social Systems with MATLAB 13 13
Using Git: Introduction Introduce yourself to Git: $ git config --global user.name "Your Name" $ git config --global user.email i@me.com Modeling and Simulating Social Systems with MATLAB 14 14
Using Git: Initialization To initialize an empty repository, you can use the command git init Initialize your first Git repository: $ cd /path/to/code/dir/ $ git init Modeling and Simulating Social Systems with MATLAB 15 15
Modeling and Simulating Social Systems with MATLAB 16
Using Git: Tracking and Committing Tell Git which files you would like to include: $ git add file1 file2 $ git add . Take a snapshot (commit) of all tracked files: $ git commit –m “This is my first commit” Modeling and Simulating Social Systems with MATLAB 17 17
Using Git: Status and Diff Show the status of the repository: $ git status Inspect the differences: $ git diff Modeling and Simulating Social Systems with MATLAB 18 18
Using Git: Some Recommendations Commit often Use meaningful commit messages New files are not automatically indexed, must be added Be careful with respect to which files to add Do not add very large files (compress videos and upload them only in the end) Write a .gitignore file or use git ignore for files that you never want to commit (e.g. big datasets) Modeling and Simulating Social Systems with MATLAB 19 19
Using Git: GitHub If you are not registered yet, please do so (every student should have an account): https://github.com/ Some initial configuration is required. 1. Copy your SSH public key to your github account 2. Fork the “report_template” repository to “my_repo” 3. Configure it (rename, add team members) 4. Clone “my_repo” on your machine 5. Push your first commit Modeling and Simulating Social Systems with MATLAB 20 20
Using Git: SSH Keys (optional) An SSH public key is a certificate of your identity If you upload your SSH public key to your Github account, you don’t have to type in username and password every time you connect to GitHub https://help.github.com/articles/generating-ssh-keys https://help.github.com/articles/set-up-git Modeling and Simulating Social Systems with MATLAB 21 21
Using Git: Fork and Configuration Needs to be performed by only one group member (one repository per group) Click the Fork button at the top of this page: https://github.com/msssm/project_template In the Settings of the forked project: Rename to a meaningful name Add your team members (collaborators) Modeling and Simulating Social Systems with MATLAB 22 22
Using Git: Clone Project Template Make a local copy of your new repository $ git clone git@github.com:USERNAME/PROJECT.git Modeling and Simulating Social Systems with MATLAB 23 23
Using Git: Remote Repos Check that your local copy of the repo points to the correct online repository (your fork) $ git remote -v origin git@github.com:USERNAME/PROJECT.git (fetch) origin git@github.com:USERNAME/PROJECT.git (push) Modeling and Simulating Social Systems with MATLAB 24 24
Using Git: Upload Commits Write your research plan inside the README file When you are happy : $ git add README.md $ git commit –m “Research Plan done” $ git push –u origin master Modeling and Simulating Social Systems with MATLAB 25 25
Using Git: Let us know Send the link to your project repository on GitHub to sbalietti@ethz.ch and olivia.woolley@gess.ethz.ch Add the tag [MSSSM] to the subject line to make our life easier (you do not want to upset your instructor early on) Modeling and Simulating Social Systems with MATLAB 26 26
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/ Git: creating a repo http://help.github.com/create-a-repo/ Git: working with remotes http://help.github.com/remotes/ EGit plugin for Eclipse: http://www.eclipse.org/egit/ Markdown: http://daringfireball.net/projects/markdown/syntax Modeling and Simulating Social Systems with MATLAB 27 27
Recommend
More recommend