Presentation is loading. Please wait.

Presentation is loading. Please wait.

© 2015 by Herb Holyst Introduction to git Cytomics Workshop December, 2015.

Similar presentations


Presentation on theme: "© 2015 by Herb Holyst Introduction to git Cytomics Workshop December, 2015."— Presentation transcript:

1 © 2015 by Herb Holyst Introduction to git Cytomics Workshop December, 2015

2 Agenda Why are we using version control? High level overview git Working locally (init, add, commit, status) Demo Working with a remote repository (clone, pull, push) Exercise 2 (remote) Managing Change (branch, fork, merging) Exercise 3 (branch, merge) Everyday git workflow…

3 Why are we using version control? Writing software is a process… Unlimited undo button Historical record Manage multiple versions of a project Create ‘New’ but related projects (Fork or Branch) Co-develop software

4 High level overview git Git is an open source software tool that is installed on your machine. Command line interface, with graphical tools It manages sets of related files which are called a project Projects a kept in a repository Repositories record all of the changes to a project Repositories can be exchanged Repositories can be merged with other repositories

5 Local Workflow Local Repository Staging Working Directory Add Commit Init

6 Basic Usage Command line interface $ git [options] [ ] Local Commands: $ git init $ git status $ git add $ git commit –m “Initial commit for workshop”

7 Intro to Git Commands: CommandPurposeExample helpGet help using gitgit help or git add --help cloneMakes a local copy of a repository git clone git@pathbio1.med.upenn.edu:holyst/ stand-by-your-pan-tb.git statusTells us what’s going on with the repo git status addStage files to be committedgit add filename(s) commitCommits staged changes to the local repository. git commit –m “What did you do?” pullGet changes from the remote repository git pull pushPushes the changes up to the named service git push

8 Demo #1 http://ndpsoftware.com/git-cheatsheet.html https://marklodato.github.io/visual-git-guide/index-en.html

9 When to Commit? Commits are like snap shots in time. Changes made during a commit should have some logical relationship. Commits should: Represent some modest amount of effort (time) Work should be related to one (or few) objective(s) Commit should NOT be: Evenly spaced units of time (Every hour…) Too small or too big.

10 Remote Local Repository pull push Remote Repository clone

11 Exercise 1 setup your git… $ git config --global user.name "John Doe” $ git config --global user.email johndoe@example.comjohndoe@example.com $ git config --global http.sslVerify “false” Clone ‘stand_by_your_pan’ project from gitlab https://pathbio1.med.upenn.edu/workshop/stand_by_your_pan.git Add / modify some file Check ‘git status’ Stage the files for commit ‘git add’ Commit the files locally ‘git commit’ Pull changes from the remote gitlab repository Push the files up to our gitlab server

12 Windows fixes Add Program Files/git/bin to the system path http://www.computerhope.com/issues/ch000549.htm for instruction on setting the pathhttp://www.computerhope.com/issues/ch000549.htm

13 Commit Each commit is assigned a ‘unique name’ (like a serial number.) The author adds a meaningful short message Commit is a snapshot of a specific branch at a specific point in time. The commit name is associated with all the files in the repository. (per branch)

14 When to Commit? A.Only when I am done. B.Every fixed amount of time. C.Every fixed amount of change. D.When I think that’s good enough. E.Before I do something risky. F.Before I go away on vacation G.Before I get hit by a bus.

15 New Commands $ git status $ git clone $ git pull $ git push $ git log $ git blame

16 Branching, Forking, Merging Branch – Variation of a complete project, expect to merge back into master. (Special branch ‘master’) Fork – Starting down a new direction. Not expect to merge back completely Merge – Combine two branches together. Rebase – Similar to merge but rewrites history.

17 Exercise 2 Pull the ‘stand-by-your-pan’ Review history Create a branch Switch between branches Push your branch up to the server Merge branches back into master

18 Walk through $ git checkout –b cool_new_idea Create some really great stuff and want to keep it… $ git push –u origin cool_new_branch $ git branch $ git branch --merged $ git checkout master $ git merge cool_new_branch $ git push $ git branch –d cool_new_idea

19 Repositories Centralized repositoryDistributed repository

20 Everyday Git Demo


Download ppt "© 2015 by Herb Holyst Introduction to git Cytomics Workshop December, 2015."

Similar presentations


Ads by Google