SlideShare a Scribd company logo
GIT Tutorial
Version control and shared development
April 30, 2018
Peder Larson, PhD
Associate Professor
UCSF Department of Radiology and Biomedical Imaging
What is git?
 Version control
• Track changes you make to software or other documents
• Go back to old versions, or look at changes
 Shared development platform
• Designed to support projects with multiple developers
• Create branches, merge and track individual user changes, report and assign issues
 Distributed
• Every version of the repository, whether local or hosted (e.g. github, Radiology gitlab) is a full
repository, so access to host required
• Transition to and from local copy to hosted repository, between hosted sites, and between local
copies
April 30, 2018Git tutorial2
Why Git?
 Sharing and jointly developing code
 Standard tool for version control & software development, easy to work with others
 Open source and free
 Distributed – track changes on your local copies
 Jobs
• Employers may consider your github/gitlab/bitbucket profile as part of your CV for tech jobs
• Ask any graduate who works on software in industry – they must use version control
 Many Tools
• e.g. github desktop client, probably many others
• Web interfaces
April 30, 2018Git tutorial3
Prominent Git Software Groups
 TensorFlow (Google) https://github.com/tensorflow
 Python https://github.com/python
 Facebook https://github.com/facebook
 LinkedIn https://github.com/linkedin
April 30, 2018Git tutorial4
Selected Imaging Repositories/Groups
 SIVIC - https://github.com/SIVICLab/sivic
 ANTS – Advanced Normalization Tools https://github.com/ANTsX/ANTs
 AFNI – Analysis of Functional NeuroImages https://github.com/afni/afni
 ISMRMRD – ISMRM raw data format
 BART – Berkeley advanced reconstruction toolbox
https://github.com/mrirecon/bart
 Many more!
April 30, 2018Git tutorial5
Git Servers and Structure
 https://git.radiology.ucsf.edu/
• Radiology git server
• Behind firewall, only accessible by Radiology users, no public repos
• Sensitive projects (data, IP)
• Easily explored by others in Radiology
 github.com
• Most widely used service
• Public and private repositories (“Repos”)
• Request academic account for unlimited free private repos for 2 years – education.github.com
 Individual accounts
 Groups – for groups with multiple shared projects, e.g. lab/research group, specific project/grant, organization
April 30, 2018Git tutorial6
My Personal Git Ecosystem
 Radiology git
• plarson - personal account, for my own
projects or initial development
‒ matlab
‒ EPSI processing
• EPIC-MRI – group account for GE MRI
EPIC programming projects (so far I’m the
only user  )
‒ 3dradial
‒ prose_prostate
‒ fidcsi_c13
‒ 3dute
‒ cones
 GitHub
• agentmess – personal account, personal projects,
papers, playing around with code
• LarsonLab – group account for shared projects and
sustained projects
‒ hyperpolarized-mri-toolbox
‒ mripy (Python tools for MRI, including neural
networks, originally from Peng Cao)
‒ Spectral-Spatial-RF-Pulse-Design
‒ MRI-education-resources
• UCSF-EPIC-MRI
‒ For sharing EPIC software with others
‒ All private repositories (GE proprietary
information)
April 30, 2018Git tutorial7
Incredibly
valuable for these
projects!
GitHub/GitLab features
 Star – any interesting code
 Watch – be notified of repo changes
 Fork – make your own copy to use and
modify
April 30, 2018Git tutorial8
Remember to …
 Commit every day!
 Practice, and don’t worry about mistakes since there’s a history of all your
changes
April 30, 2018Git tutorial9
Initialization
1. Login – git.radiology.ucsf.edu or github.com
2. Create New Repository/Project
3. Clone ‘git clone <address>’
• Copy address from web
• Clone to multiple places (laptop, SCS network)
4. Add files or import in existing directory
5. Check file status ‘git status’, should show Untracked Files
6. Add these files to git repository with ‘git add’
7. Check file status ‘git status’, should show Changes to Be Committed
8. Commit ’git commit –m “<commit message>” ‘
9. Push changes to remote repository (e.g. github, radiology git) ‘git push’
10. Check web!
April 30, 2018Git tutorial10
Daily Workflow
1. Pull changes from remote repo (in case others have added edits) ‘git pull’
• If you are just a user (not developer) of repo/project, then this is all you need
2. Modify files
3. Check status ‘git status’
4. Add changes ‘git add’
5. Confirm status ‘git status’
6. Commit ‘git commit’
7. Push changes ‘git push’ (don’t need to do for every commit, but at least every day is best)
 Quick commit – ‘git commit –a –m <message>” stages all changes to be commited and then commits
April 30, 2018Git tutorial11
Advanced Workflows - ignoring files
 .gitignore – this is a file within your git repository that can choose to ignore
certain files. For example, large data files, temporary files, executables.
• .gitignore templates at https://github.com/github/gitignore
• Copy into main directory
• In GitHub Desktop app, right-click to add files to .gitignore
 Want to store large files? Use “git-lfs” (large file storage) git-lfs.github.com
April 30, 2018Git tutorial12
Advanced Workflows - Branching
 “Branch”
• separate version of repository to work on
• Create a branch to fix a bug, add a new feature, or play around without
disrupting the “master” branch (default branch when you start a project
• Easy to explore and visualize via web interfaces
• First branch created is the “master”
April 30, 2018Git tutorial13
Advanced Workflows – Creating and Editing New
Branch
Via Web interface
Then switch to branch in repository
1. List all branches ‘git branch –a’
2. Checkout new branch ‘git checkout <branchname>’
3. Confirm you are now working on new branch ‘git branch’
Or Command Line
1. Check current branch ‘git branch -a’ (lists branches, * indicated curent branch_
2. Switch to starting branch if needed, e.g. ‘git checkout master’ to create branch from master
3. Create new branch ‘git branch <branchname>’
4. Checkout new branch ‘git checkout <branchname>’
5. Confirm you are now working on new branch ‘git branch’
April 30, 2018Git tutorial14
Advanced Workflows – Creating and Editing New
Branch
 Normally, a repository is a single directory and you can switch between branches (‘git branch’
to view branches, ‘git checkout <branchname>’ to switch)
 This can cause problems if you (like me) forget to check what branch you are working on
 Alternative
 Keep one repository as a ‘master’
 git clone git@git.radiology.ucsf.edu:PLarson/git-tutorial-test.git git-tutorial-test_master
 Clone another version of repo for development(more like SVN)
 git clone git@git.radiology.ucsf.edu:PLarson/git-tutorial-test.git git-tutorial-test_branch
 cd git-tutorial-test_branch
 git checkout <branchname>
April 30, 2018Git tutorial15
Advanced Workflows – Merging Branches
 Create a Merge/pull request
• When you want to put branches together, merge the changes
• E.g. you have added feature in a feature branch, merge back into the master
branch
• I find this easiest via web interfaces
 When you push changes ‘git push’, message:
• remote: To create a merge request for branch2, visit:
• remote: https://git.radiology.ucsf.edu/PLarson/git-tutorial-
test/merge_requests/new?merge_request%5Bsource_branch%5D=branch2
 Review and submit merge request
 Confirm request and submit (last steps are so you can review the changes
carefully before continuing)
April 30, 2018Git tutorial16
Fixing conflicts
Can arise when remote repo is out of sync with local copy, or during merging of
branches
1. Find conflicting files ‘git status’
2. Edit with your favorite editor
• Conflicting lines marked with <<<<, ====, >>>>
• Choose appropriate changes, remove lines with <<<<, ====, >>>>
3. Mark resolution with ‘git add’
4. Commit
5. Push
April 30, 2018Git tutorial17
Advanced Workflows - Other
 Multiple Remote Repos (e.g. github vs radiology git)
• Can sync local copy with both
• Move repository to other location
1. Create empty repository
2. Add as a remote ‘git remote add github https://github.com/agentmess/git-
tutorial-test.git’ (can change “github” to be description of another remote
repository, use ”origin” if you want to make this the new default repository )
3. Push to new remote ‘git push --all github’
April 30, 2018Git tutorial18
Advanced Workflows - Other
 Tags/releases
• When you’ve got a stable product
• Allows others to easily find stable version or version that will work for them
 Issues
• Keep track of bugs to fix or features to add
April 30, 2018Git tutorial19
Other features for citing and sharing (GitHub based)
 Zenodo for citing code
• Get DOI for citing your code!
• https://zenodo.org/account/settings/github/
 Webpages – e.g. Radiology retreat, BART https://mrirecon.github.io/bart/
• https://pages.github.com/
• Setup at username.github.io
 MATLAB File Exchange – automatically post your MATLAB code from github
here
April 30, 2018Git tutorial20
More resources
 Google your error message
 https://intrarad.ucsf.edu/twiki/bin/view/Sysadmin/GitLab
 https://git.radiology.ucsf.edu/EPIC-MRI/BestPractices
 Getting Started guides on github and gitlab
April 30, 2018Git tutorial21
Remember to …
 Commit every day!
 Practice, and don’t worry about mistakes since there’s a history of all your
changes
 git on it
 git your roll on
 git ‘er done
 everybody git together
April 30, 2018Git tutorial22
Ad

More Related Content

What's hot (19)

Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
SlideTeam
 
Git
GitGit
Git
Alf Chang
 
Git introduction
Git introductionGit introduction
Git introduction
satyendrajaladi
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26
msohn
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Git for uninitiated
Git for uninitiatedGit for uninitiated
Git for uninitiated
John C. Chan
 
Git
GitGit
Git
Majid Hajiloo
 
Git 101
Git 101Git 101
Git 101
jayrparro
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
GitHub
GitHubGitHub
GitHub
ThomasLai27
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
Ashok Kumar Satuluri
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
Ignacio Martín
 
Roslyn on GitHub
Roslyn on GitHubRoslyn on GitHub
Roslyn on GitHub
Immo Landwerth
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
Sebin Benjamin
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
SlideTeam
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
DSCVSSUT
 
News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26News from Git in Eclipse - EclipseCon EU - 2016-10-26
News from Git in Eclipse - EclipseCon EU - 2016-10-26
msohn
 
Version Control with Git
Version Control with GitVersion Control with Git
Version Control with Git
Luigi De Russis
 
Git for uninitiated
Git for uninitiatedGit for uninitiated
Git for uninitiated
John C. Chan
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Let's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHubLet's Git this Party Started: An Introduction to Git and GitHub
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
Git and github fundamentals
Git and github fundamentalsGit and github fundamentals
Git and github fundamentals
RajKharvar
 

Similar to Git tutorial (20)

Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Git and GitHub Presentation of GDG on Campus UNSTPB
Git and GitHub Presentation of GDG on Campus UNSTPBGit and GitHub Presentation of GDG on Campus UNSTPB
Git and GitHub Presentation of GDG on Campus UNSTPB
AmaraCostachiu
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
Git workshop
Git workshopGit workshop
Git workshop
Reslan Al Tinawi
 
Git and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPBGit and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
KeerthanaJ32
 
tech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptxtech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptx
ashishraulin
 
GitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna UniversityGitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
16 Git
16 Git16 Git
16 Git
Hadley Wickham
 
Git
GitGit
Git
SamarjitMahi
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Techoalien git
Techoalien gitTechoalien git
Techoalien git
Aditya Tiwari
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
MohammadSamiuddin10
 
Git and GitHub PowerPoint Presentation**
Git and GitHub PowerPoint Presentation**Git and GitHub PowerPoint Presentation**
Git and GitHub PowerPoint Presentation**
KalpeshGandha
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
Betclic Everest Group Tech Team
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
Cristian Lucchesi
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Git and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPBGit and GitHub Workshop of GDG on Campus UNSTPB
Git and GitHub Workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
Git and GitHub Presentation of GDG on Campus UNSTPB
Git and GitHub Presentation of GDG on Campus UNSTPBGit and GitHub Presentation of GDG on Campus UNSTPB
Git and GitHub Presentation of GDG on Campus UNSTPB
AmaraCostachiu
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
Git and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPBGit and GitHub workshop of GDG on Campus UNSTPB
Git and GitHub workshop of GDG on Campus UNSTPB
AmaraCostachiu
 
tech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptxtech winter break workshop on git &git hub.pptx
tech winter break workshop on git &git hub.pptx
ashishraulin
 
GitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna UniversityGitHub and Open Source - GDGoC MIT Anna University
GitHub and Open Source - GDGoC MIT Anna University
mitgdsc
 
Git and GitHub PowerPoint Presentation**
Git and GitHub PowerPoint Presentation**Git and GitHub PowerPoint Presentation**
Git and GitHub PowerPoint Presentation**
KalpeshGandha
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Ad

More from Peder Larson (15)

Mentoring trainees in research
Mentoring trainees in researchMentoring trainees in research
Mentoring trainees in research
Peder Larson
 
Lung MRI
Lung MRILung MRI
Lung MRI
Peder Larson
 
Principles of (N)MR Imaging
Principles of (N)MR Imaging Principles of (N)MR Imaging
Principles of (N)MR Imaging
Peder Larson
 
Hyperpolarization - Description, Overview, & Methods
Hyperpolarization - Description, Overview, & MethodsHyperpolarization - Description, Overview, & Methods
Hyperpolarization - Description, Overview, & Methods
Peder Larson
 
UCSF Hyperpolarized MR #8-2: Neurological (2019)
UCSF Hyperpolarized MR #8-2: Neurological (2019)UCSF Hyperpolarized MR #8-2: Neurological (2019)
UCSF Hyperpolarized MR #8-2: Neurological (2019)
Peder Larson
 
UCSF Hyperpolarized MR #8-1: Cancer (2019)
UCSF Hyperpolarized MR #8-1: Cancer (2019)UCSF Hyperpolarized MR #8-1: Cancer (2019)
UCSF Hyperpolarized MR #8-1: Cancer (2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-1: Analysis (2019)
UCSF Hyperpolarized MR #7-1: Analysis (2019)UCSF Hyperpolarized MR #7-1: Analysis (2019)
UCSF Hyperpolarized MR #7-1: Analysis (2019)
Peder Larson
 
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
Peder Larson
 
UCSF Hyperpolarized MR #5: Experimental Design (2019)
UCSF Hyperpolarized MR #5: Experimental Design (2019)UCSF Hyperpolarized MR #5: Experimental Design (2019)
UCSF Hyperpolarized MR #5: Experimental Design (2019)
Peder Larson
 
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
Peder Larson
 
UCSF Hyperpolarized MR #3: Sample Preps
UCSF Hyperpolarized MR #3: Sample PrepsUCSF Hyperpolarized MR #3: Sample Preps
UCSF Hyperpolarized MR #3: Sample Preps
Peder Larson
 
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
Peder Larson
 
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
Peder Larson
 
Mentoring trainees in research
Mentoring trainees in researchMentoring trainees in research
Mentoring trainees in research
Peder Larson
 
Principles of (N)MR Imaging
Principles of (N)MR Imaging Principles of (N)MR Imaging
Principles of (N)MR Imaging
Peder Larson
 
Hyperpolarization - Description, Overview, & Methods
Hyperpolarization - Description, Overview, & MethodsHyperpolarization - Description, Overview, & Methods
Hyperpolarization - Description, Overview, & Methods
Peder Larson
 
UCSF Hyperpolarized MR #8-2: Neurological (2019)
UCSF Hyperpolarized MR #8-2: Neurological (2019)UCSF Hyperpolarized MR #8-2: Neurological (2019)
UCSF Hyperpolarized MR #8-2: Neurological (2019)
Peder Larson
 
UCSF Hyperpolarized MR #8-1: Cancer (2019)
UCSF Hyperpolarized MR #8-1: Cancer (2019)UCSF Hyperpolarized MR #8-1: Cancer (2019)
UCSF Hyperpolarized MR #8-1: Cancer (2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
UCSF Hyperpolarized MR #7-3: Prostate EPSI processing(2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
UCSF Hyperpolarized MR #7-2: Brain EPI processing(2019)
Peder Larson
 
UCSF Hyperpolarized MR #7-1: Analysis (2019)
UCSF Hyperpolarized MR #7-1: Analysis (2019)UCSF Hyperpolarized MR #7-1: Analysis (2019)
UCSF Hyperpolarized MR #7-1: Analysis (2019)
Peder Larson
 
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
UCSF Hyperpolarized MR #6-1: Cardiac Applications (2019)
Peder Larson
 
UCSF Hyperpolarized MR #5: Experimental Design (2019)
UCSF Hyperpolarized MR #5: Experimental Design (2019)UCSF Hyperpolarized MR #5: Experimental Design (2019)
UCSF Hyperpolarized MR #5: Experimental Design (2019)
Peder Larson
 
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
UCSF Hyperpolarized MR #4: Acquisition and RF Coils (2019)
Peder Larson
 
UCSF Hyperpolarized MR #3: Sample Preps
UCSF Hyperpolarized MR #3: Sample PrepsUCSF Hyperpolarized MR #3: Sample Preps
UCSF Hyperpolarized MR #3: Sample Preps
Peder Larson
 
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
UCSF Hyperpolarized MR #2: DNP Physics and Hardware (2019
Peder Larson
 
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
UCSF Hyperpolarized MR #1: Introduction to Hyperpolarized MR (2019)
Peder Larson
 
Ad

Recently uploaded (20)

Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Top 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docxTop 10 Client Portal Software Solutions for 2025.docx
Top 10 Client Portal Software Solutions for 2025.docx
Portli
 
Revolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptxRevolutionizing Residential Wi-Fi PPT.pptx
Revolutionizing Residential Wi-Fi PPT.pptx
nidhisingh691197
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
Download Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With LatestDownload Wondershare Filmora Crack [2025] With Latest
Download Wondershare Filmora Crack [2025] With Latest
tahirabibi60507
 
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Proactive Vulnerability Detection in Source Code Using Graph Neural Networks:...
Ranjan Baisak
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025Adobe Master Collection CC Crack Advance Version 2025
Adobe Master Collection CC Crack Advance Version 2025
kashifyounis067
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)WinRAR Crack for Windows (100% Working 2025)
WinRAR Crack for Windows (100% Working 2025)
sh607827
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025Adobe Lightroom Classic Crack FREE Latest link 2025
Adobe Lightroom Classic Crack FREE Latest link 2025
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...Explaining GitHub Actions Failures with Large Language Models Challenges, In...
Explaining GitHub Actions Failures with Large Language Models Challenges, In...
ssuserb14185
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Salesforce Data Cloud- Hyperscale data platform, built for Salesforce.
Dele Amefo
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 

Git tutorial

  • 1. GIT Tutorial Version control and shared development April 30, 2018 Peder Larson, PhD Associate Professor UCSF Department of Radiology and Biomedical Imaging
  • 2. What is git?  Version control • Track changes you make to software or other documents • Go back to old versions, or look at changes  Shared development platform • Designed to support projects with multiple developers • Create branches, merge and track individual user changes, report and assign issues  Distributed • Every version of the repository, whether local or hosted (e.g. github, Radiology gitlab) is a full repository, so access to host required • Transition to and from local copy to hosted repository, between hosted sites, and between local copies April 30, 2018Git tutorial2
  • 3. Why Git?  Sharing and jointly developing code  Standard tool for version control & software development, easy to work with others  Open source and free  Distributed – track changes on your local copies  Jobs • Employers may consider your github/gitlab/bitbucket profile as part of your CV for tech jobs • Ask any graduate who works on software in industry – they must use version control  Many Tools • e.g. github desktop client, probably many others • Web interfaces April 30, 2018Git tutorial3
  • 4. Prominent Git Software Groups  TensorFlow (Google) https://github.com/tensorflow  Python https://github.com/python  Facebook https://github.com/facebook  LinkedIn https://github.com/linkedin April 30, 2018Git tutorial4
  • 5. Selected Imaging Repositories/Groups  SIVIC - https://github.com/SIVICLab/sivic  ANTS – Advanced Normalization Tools https://github.com/ANTsX/ANTs  AFNI – Analysis of Functional NeuroImages https://github.com/afni/afni  ISMRMRD – ISMRM raw data format  BART – Berkeley advanced reconstruction toolbox https://github.com/mrirecon/bart  Many more! April 30, 2018Git tutorial5
  • 6. Git Servers and Structure  https://git.radiology.ucsf.edu/ • Radiology git server • Behind firewall, only accessible by Radiology users, no public repos • Sensitive projects (data, IP) • Easily explored by others in Radiology  github.com • Most widely used service • Public and private repositories (“Repos”) • Request academic account for unlimited free private repos for 2 years – education.github.com  Individual accounts  Groups – for groups with multiple shared projects, e.g. lab/research group, specific project/grant, organization April 30, 2018Git tutorial6
  • 7. My Personal Git Ecosystem  Radiology git • plarson - personal account, for my own projects or initial development ‒ matlab ‒ EPSI processing • EPIC-MRI – group account for GE MRI EPIC programming projects (so far I’m the only user  ) ‒ 3dradial ‒ prose_prostate ‒ fidcsi_c13 ‒ 3dute ‒ cones  GitHub • agentmess – personal account, personal projects, papers, playing around with code • LarsonLab – group account for shared projects and sustained projects ‒ hyperpolarized-mri-toolbox ‒ mripy (Python tools for MRI, including neural networks, originally from Peng Cao) ‒ Spectral-Spatial-RF-Pulse-Design ‒ MRI-education-resources • UCSF-EPIC-MRI ‒ For sharing EPIC software with others ‒ All private repositories (GE proprietary information) April 30, 2018Git tutorial7 Incredibly valuable for these projects!
  • 8. GitHub/GitLab features  Star – any interesting code  Watch – be notified of repo changes  Fork – make your own copy to use and modify April 30, 2018Git tutorial8
  • 9. Remember to …  Commit every day!  Practice, and don’t worry about mistakes since there’s a history of all your changes April 30, 2018Git tutorial9
  • 10. Initialization 1. Login – git.radiology.ucsf.edu or github.com 2. Create New Repository/Project 3. Clone ‘git clone <address>’ • Copy address from web • Clone to multiple places (laptop, SCS network) 4. Add files or import in existing directory 5. Check file status ‘git status’, should show Untracked Files 6. Add these files to git repository with ‘git add’ 7. Check file status ‘git status’, should show Changes to Be Committed 8. Commit ’git commit –m “<commit message>” ‘ 9. Push changes to remote repository (e.g. github, radiology git) ‘git push’ 10. Check web! April 30, 2018Git tutorial10
  • 11. Daily Workflow 1. Pull changes from remote repo (in case others have added edits) ‘git pull’ • If you are just a user (not developer) of repo/project, then this is all you need 2. Modify files 3. Check status ‘git status’ 4. Add changes ‘git add’ 5. Confirm status ‘git status’ 6. Commit ‘git commit’ 7. Push changes ‘git push’ (don’t need to do for every commit, but at least every day is best)  Quick commit – ‘git commit –a –m <message>” stages all changes to be commited and then commits April 30, 2018Git tutorial11
  • 12. Advanced Workflows - ignoring files  .gitignore – this is a file within your git repository that can choose to ignore certain files. For example, large data files, temporary files, executables. • .gitignore templates at https://github.com/github/gitignore • Copy into main directory • In GitHub Desktop app, right-click to add files to .gitignore  Want to store large files? Use “git-lfs” (large file storage) git-lfs.github.com April 30, 2018Git tutorial12
  • 13. Advanced Workflows - Branching  “Branch” • separate version of repository to work on • Create a branch to fix a bug, add a new feature, or play around without disrupting the “master” branch (default branch when you start a project • Easy to explore and visualize via web interfaces • First branch created is the “master” April 30, 2018Git tutorial13
  • 14. Advanced Workflows – Creating and Editing New Branch Via Web interface Then switch to branch in repository 1. List all branches ‘git branch –a’ 2. Checkout new branch ‘git checkout <branchname>’ 3. Confirm you are now working on new branch ‘git branch’ Or Command Line 1. Check current branch ‘git branch -a’ (lists branches, * indicated curent branch_ 2. Switch to starting branch if needed, e.g. ‘git checkout master’ to create branch from master 3. Create new branch ‘git branch <branchname>’ 4. Checkout new branch ‘git checkout <branchname>’ 5. Confirm you are now working on new branch ‘git branch’ April 30, 2018Git tutorial14
  • 15. Advanced Workflows – Creating and Editing New Branch  Normally, a repository is a single directory and you can switch between branches (‘git branch’ to view branches, ‘git checkout <branchname>’ to switch)  This can cause problems if you (like me) forget to check what branch you are working on  Alternative  Keep one repository as a ‘master’  git clone [email protected]:PLarson/git-tutorial-test.git git-tutorial-test_master  Clone another version of repo for development(more like SVN)  git clone [email protected]:PLarson/git-tutorial-test.git git-tutorial-test_branch  cd git-tutorial-test_branch  git checkout <branchname> April 30, 2018Git tutorial15
  • 16. Advanced Workflows – Merging Branches  Create a Merge/pull request • When you want to put branches together, merge the changes • E.g. you have added feature in a feature branch, merge back into the master branch • I find this easiest via web interfaces  When you push changes ‘git push’, message: • remote: To create a merge request for branch2, visit: • remote: https://git.radiology.ucsf.edu/PLarson/git-tutorial- test/merge_requests/new?merge_request%5Bsource_branch%5D=branch2  Review and submit merge request  Confirm request and submit (last steps are so you can review the changes carefully before continuing) April 30, 2018Git tutorial16
  • 17. Fixing conflicts Can arise when remote repo is out of sync with local copy, or during merging of branches 1. Find conflicting files ‘git status’ 2. Edit with your favorite editor • Conflicting lines marked with <<<<, ====, >>>> • Choose appropriate changes, remove lines with <<<<, ====, >>>> 3. Mark resolution with ‘git add’ 4. Commit 5. Push April 30, 2018Git tutorial17
  • 18. Advanced Workflows - Other  Multiple Remote Repos (e.g. github vs radiology git) • Can sync local copy with both • Move repository to other location 1. Create empty repository 2. Add as a remote ‘git remote add github https://github.com/agentmess/git- tutorial-test.git’ (can change “github” to be description of another remote repository, use ”origin” if you want to make this the new default repository ) 3. Push to new remote ‘git push --all github’ April 30, 2018Git tutorial18
  • 19. Advanced Workflows - Other  Tags/releases • When you’ve got a stable product • Allows others to easily find stable version or version that will work for them  Issues • Keep track of bugs to fix or features to add April 30, 2018Git tutorial19
  • 20. Other features for citing and sharing (GitHub based)  Zenodo for citing code • Get DOI for citing your code! • https://zenodo.org/account/settings/github/  Webpages – e.g. Radiology retreat, BART https://mrirecon.github.io/bart/ • https://pages.github.com/ • Setup at username.github.io  MATLAB File Exchange – automatically post your MATLAB code from github here April 30, 2018Git tutorial20
  • 21. More resources  Google your error message  https://intrarad.ucsf.edu/twiki/bin/view/Sysadmin/GitLab  https://git.radiology.ucsf.edu/EPIC-MRI/BestPractices  Getting Started guides on github and gitlab April 30, 2018Git tutorial21
  • 22. Remember to …  Commit every day!  Practice, and don’t worry about mistakes since there’s a history of all your changes  git on it  git your roll on  git ‘er done  everybody git together April 30, 2018Git tutorial22