a

b

c

d

Introduction

Theory

Method

Results

git  for  everything

Massimo Pinto  ENEA-INMRI, Italy

Reid Townson  NRC, Canada

Romain Coulon  BIPM

Frédéric Tessier  NRC, Canada

Frédéric Meynadier  BIPM

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM,

Frédéric Meynadier  BIPM

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM,

Frédéric Meynadier  BIPM

Today you will learn (something) about git

  • What is version control? Why not simply “Save As...” successive versions of a file?
  • What does this have to do with metrology? Is it not just for programmers?
  • Why is the free git software efficient compared to alternatives methods?
  • Can I start using git today for my work (code, data, papers, quality system, etc.)?
  • How could my team edit files collaboratively and concurrently?
  • Where can I share my work: github.com, gitlab.com, bitbucket.org?
  • Who can offer compelling examples of git applications in metrology?
  • Why is it called git anyways? Why is it dubbed the stupid content tracker?

Version control saves you  from a “Save as...”  fiasco

filenames and timestamps are unreliable for tracking versions

Jorge Cham,  phdcomics.com

trying to make sense from the filename

trying to make sense from the timestamp

Version control saves you  from a “Save as...”  fiasco

Image from PhDComics.com

Jorge Cham,  phdcomics.com

File system information is not robust:

Filename is arbitrary; timestamp can be updated inadvertently upon saving or copying; or restoring from backup.

Information is lost when the file is deleted.

Multiple copies (versions) make it worse!

What we need:

A robust record of file modifications, to answer the 5 “w’s”: Who, What, When, Where, and Why?

A tool to work collaboratively and concurrently.

Version control is a two-way street

Jonathan McGlone, @jmcglone

Proper version control offers a solid track record of your file modifications, and those of your collaborators.

A version acts as a snapshot in time: any set of changes can be recorded as a version.

Each version is documented.
It’s your diary.

You can inspect and recover any version in your project history, 
and compare
any two versions.

A long history of version control software:
SCCS, RCS, CVS, subversion, helix core,  bazaar, bitkeeper, git, ...

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

git is a many-street  network

main

your work

someone
else’s work

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

You can merge in any successful idea into the main project branch at any point, automatically.

git is a many-street  network

your work

someone
else’s work

main

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

You can merge in any successful idea into the main project branch at any point, automatically.

A repository is the collection of all commits and branches for a given project.

git is a many-street  network

repository

git is a many-street  network

clone

clone

clone

you @ office

backup

you @ home

collaborator

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

You can merge in any successful idea into the main project branch at any point, automatically.

A repository is the collection of all commits and branches for a given project.

A repository can be duplicated and shared. Every clone gets the full history.

git is a many-street  network

you @ office

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

You can merge in any successful idea into the main project branch at any point, automatically.

A repository is the collection of all commits and branches for a given project.

A repository can be duplicated and shared. Every clone gets the full history.

distributed
(no central server)

you @ home

collaborator

backup

git is a many-street  network

pull

pull

pull

collaborator

backup

you @ office

Anyone can explore new ideas and experiment with different versions on the side with branches, without affecting the main project branch.

You can merge in any successful idea into the main project branch at any point, automatically.

A repository is the collection of all commits and branches for a given project.

A repository can be duplicated and shared. Every clone gets the full history.

you @ home

git enables open science

As you embrace the open science paradigm, you can share your work (code, methods, data, reports, etc.) on a hosting platform, for example:

A penelope code to calculate correction factors for effects in diaphragms in free-air chambers

As you embrace the open science paradigm, you can share your work (code, methods, data, reports, etc.) on a hosting platform, for example:

Kurosawa T, Takata N and Saito N.
Effect of the diaphragm of free-air ionization chamber for X-ray air-kerma measurements,
Radiation Protection Dosimetry 146, 195–7 (2011)

git enables open science

A penelope code to calculate correction factors for effects in diaphragms in free-air chambers

git enables open science

As you embrace the open science paradigm, you can share your work (code, methods, data, reports, etc.) on a hosting platform, for example:

A python software tool to generate
x-ray spectra using SpekPy

Bujila R, Omar A and Poludniowski G.
A validation of SpekPy: a software toolkit for modelling X-ray tube spectra,

Physica Medica: European Journal of Medical Physics 75, 44–54 (2020)

As you embrace the open science paradigm, you can share your work (code, methods, data, reports, etc.) on a hosting platform, for example:

Image from PhDComics.com

Don’t feel intimidated by the breadth of git, or its learning curve: nobody starts using git by actually knowing how it works. As with other software, you learn by doing. Note that most operations in git can be undone, so feel free to experiment!

“git” started today, help is just a click away 

Documentation and tutorials:

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM,

Frédéric Meynadier  BIPM

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM,

Frédéric Meynadier  BIPM

git is a file versioning technology

git (command-line)

...

software guis

VS Code

Sourcetree

GitKraken

web hosting

...

GitHub

GitLab

Bitbucket

version “as a service”

...

many apps built for git
or rely on git

Overleaf

Jujutsu

gitless

git is a file versioning technology

git (command-line)

...

software guis

VS Code

Sourcetree

GitKraken

web hosting

...

GitHub

GitLab

Bitbucket

version “as a service”

many apps built for git
or rely on git

Gitpod

Overleaf

Colaboratory

...

Scientists have the right mindset for version control

measurements over time

science

measurement (a datum)

files over time

commit (a change)

git

Scientists have the right mindset for version control

measurements over time

science

traceability

accountability

accuracy

precision

reproducibility

documentation

comparison

measurement (a datum)

files over time

log

commit authorship

commit hash

single-character change

clone

commit message

diff

commit (a change)

git

The git “philosophy” is: a chain of changes

git

repository

folder

traditional

“universe” is the folder

myproject/

The git “philosophy” is: a chain of changes

git

repository

c

d

e

“universe” is the set of folder states

a

b

“universe” is the folder

folder

traditional

myproject/

a

b

c

d

e

git adds a “change” axis to a folder

The git “philosophy” is: a chain of changes

Like snapshots for your work; you decide when to record a snapshot.

a

c

d

e

b

The git “philosophy” is: a chain of changes

git adds a “change” axis to a folder

Think in terms of project states, not files: states pertain to the entire project.

a

c

d

e

b

The git “philosophy” is: a chain of changes

git adds a “change” axis to a folder

A state only records changes.

changes from a

init

changes from b

changes from c

changes from d

changes from a

init

a

c

d

e

b

The git “philosophy” is: a chain of changes

git adds a “change” axis to a folder

changes from c

changes from d

A state only records changes, with respect to a parent state.

changes from b

git’s fundamental “atom” is the commit

c

Most git operations relate directly to commits.

changes from parent

changes from parent

c”

git’s fundamental “unit” is the commit

3f2f1b8...

blobs and trees

log message

author, date, ...

Most git operations relate directly to commits.

changes from parent

The commit identifier is unequivocal

3f2f1b8...

blobs and trees

The commit identifier is the SHA-1 hash of its content.

log message

author, date, ...

9af0cd4...

SHA-1 hash

40 hexadecimal characters (160 bits)

changes from parent

The commit identifier is unequivocal

3f2f1b8...

blobs and trees

The commit identifier is the SHA-1 hash of its content.

log message

author, date, ...

9af0cd4...

SHA-1 hash

9af0cd4...

40 hexadecimal characters (160 bits)

changes from parent

The commit identifier is unequivocal

3f2f1b8...

blobs and trees

log message

author, date, ...

3f2f1b8...

9af0cd4...

9af0cd4...

SHA-1 hash

The commit identifier is the SHA-1 hash of its content, including the parent identifier.

40 hexadecimal characters (160 bits)

The commit chain guarantees data integrity

Alice

0f3caf9

9af0cd4

25fed04

3f2f1b8

c995654

8ee6494

e1e03b7

5b9adde

bb4325e

bfc5afc

1dc307f

9f4b07d

9456bc3

4534cdd

The git history is a cryptographic “blockchain”

(without proof-of-work).

Bob

9af0cd4

25fed04

3f2f1b8

c995654

8ee6494

e1e03b7

5b9adde

bb4325e

bfc5afc

1dc307f

9f4b07d

9456bc3

4534cdd

0f3caf9

The commit chain guarantees data integrity

Alice

0f3caf9

The git history is a cryptographic “blockchain”

(without proof-of-work).

Bob

9af0cd4

174b7f4

3f2f1b8

c995654

8ee6494

e1e03b7

d601706

a1a1fff

404fd5f

b473e64

9f4b07d

9456bc3

4534cdd

da3d38e

9af0cd4

3f2f1b8

c995654

8ee6494

e1e03b7

9f4b07d

9456bc3

4534cdd

25fed04

5b9adde

bb4325e

bfc5afc

1dc307f

Many commits can share the same parent: branches

Alice

0f3caf9

Bob

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

Alice and Bob can work concurrently on the same project.

9af0cd4

3f2f1b8

c995654

8ee6494

e1e03b7

9f4b07d

9456bc3

4534cdd

25fed04

5b9adde

bb4325e

bfc5afc

1dc307f

Many commits can share the same parent: branches

main

0f3caf9

new-feature

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

9af0cd4

3f2f1b8

c995654

8ee6494

e1e03b7

9f4b07d

9456bc3

4534cdd

25fed04

5b9adde

bb4325e

bfc5afc

1dc307f

One person can work concurrently on different project tracks.

A commit may have multiple parents: merge

0f3caf9

main

git merges file modifications automatically (or helps you resolve conflicts).

c50c05f

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

25fed04

5b9adde

bb4325e

bfc5afc

1dc307f

9af0cd4

3f2f1b8

c995654

8ee6494

e1e03b7

9f4b07d

9456bc3

4534cdd

A commit may have multiple parents: merge

main

Branch labels advance automatically when commits are added.

56f6492

c50c05f

0f3caf9

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

25fed04

5b9adde

bb4325e

bfc5afc

1dc307f

9af0cd4

3f2f1b8

c995654

8ee6494

e1e03b7

9f4b07d

9456bc3

4534cdd

You can “time travel” to any commit

56f6492

new-idea

A branch is simply a mnemonic label for a commit hash.

git branch new-idea 8ee6494
git checkout new-idea

main

c50c05f

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

8ee6494

0f3caf9

9af0cd4

25fed04

3f2f1b8

c995654

e1e03b7

5b9adde

bb4325e

bfc5afc

1dc307f

9f4b07d

9456bc3

4534cdd

You can “time travel” to any commit

new-idea

A branch is simply a mnemonic label for a commit hash.

b56a084

7f89723

fe620ac

07a73e6

63a61f9

2c1ea58

56f6492

git branch new-idea 8ee6494
git checkout new-idea

main

c50c05f

0f3caf9

9af0cd4

25fed04

3f2f1b8

c995654

8ee6494

e1e03b7

5b9adde

bb4325e

bfc5afc

1dc307f

9f4b07d

9456bc3

4534cdd

da3d38e

174b7f4

d601706

a1a1fff

404fd5f

b473e64

A git repository is a “bag of commits”

7f89723

fe620ac

07a73e6

63a61f9

2c1ea58

56f6492

c50c05f

0f3caf9

174b7f4

d601706

a1a1fff

404fd5f

b473e64

b56a084

9af0cd4

25fed04

3f2f1b8

c995654

8ee6494

e1e03b7

5b9adde

bb4325e

bfc5afc

1dc307f

9f4b07d

9456bc3

4534cdd

da3d38e

new-idea

main

git stores commit objects, there is no “link object” (each commit knows its parent).

A git repository is a “bag of commits”

3f2f1b8

8ee6494

c995654

e1e03b7

9f4b07d

9456bc3

4534cdd

9af0cd4

25fed04

bfc5afc

5b9adde

bb4325e

1dc307f

0f3caf9

c50c05f

174b7f4

404fd5f

d601706

a1a1fff

b473e64

da3d38e

7f89723

63a61f9

fe620ac

07a73e6

2c1ea58

56f6492

main

b56a084

new-idea

myproject/.git/

individual,
self-contained objects

connect the dots !

A git repository is a “bag of commits”

3f2f1b8

8ee6494

c995654

e1e03b7

9f4b07d

9456bc3

4534cdd

9af0cd4

25fed04

bfc5afc

5b9adde

bb4325e

1dc307f

0f3caf9

c50c05f

174b7f4

404fd5f

d601706

a1a1fff

b473e64

da3d38e

7f89723

63a61f9

fe620ac

07a73e6

2c1ea58

56f6492

main

b56a084

new-idea

myproject/.git/

individual,
self-contained objects

204d614

cb4dea8

d8f8b59

566ad69

09717f9

pull

60aceae

alice

sets of commits are portable

commits are persistent

deleting a branch does not delete
the commits

changes from parent

The key to useful version control is the log

blobs and trees

log message

author, date, ...

A repository is only as good as its documentation.

9af0cd4...

SHA-1 hash

3f2f1b8...

The key to useful version control is the log

log messages

$ git log --oneline

a6fc389c Merge #685: develop into master for 2021 release
7b7b9a5b Fix documentation warnings, links, tags, year
78e8745d Tweak README and add links to EGSnrc Discussions
60110c9a Bring 'develop' branch up to date with 'master'
7cfc660c Merge additional small stuff before release 2021
7a478e9f Update README to match EGSnrc web page
7a190b0d Update copyright years and fix duplicate reference
fd24a3fe Merge #684: small stuff for the 2021 release
8a0bcb40 Clarify notation for slab input in xyz geometry
58478a2c Fix loop index compiler warning in egs_cylinders.h
d17c479a Fix typo in egs_kerma documentation
b814bb3a Adjust format, typos, comments, docs, etc.
f57d3dbb Add a comment in getting-started about mingw
2030db2e Fix n_split equation in DOSXYZnrc documentation
30d10d19 Change Google+ community reference to reddit
d2ec76e0 Merge #588: run parallel jobs without a lock file
02258354 Run C preprocessor on Mortran apps to parse #ifdef
b08afa94 Remove -j12 option for testing in CI pipeline
c71955df Adjust eol spaces, remove leftover merge markers
5c4f81e0 Merge #683: add egs++ lattice geometry (see #561)
9b942fc1 Adjust headers, add citation pages and reflow
9edf97df Add egs_lattice geometry to the egs++ Makefile
77664e05 Add a reference to the egs_lattice paper
e91e2c41 Document the egs_lattice geometry variables
cc6d2100 Add egs_lattice geometry and sample input file
c778e2a7 Merge #628: add new set of egs-parallel scripts
01b86ac0 Add command to get thread count on Darwin system
66fea4bc Fix timing and atomic relaxations in CAVRZnrc
da12bc0c Preserve information after DOSXYZnrc parallel run
7ab5e620 Fix lock file errors when using a BEAMnrc library
67d4608d Check uniform RCO job termination in Motran apps
cc477746 Fix total ncase for the job control file object
3910e125 Add -u (--urc) run control option to egs++ apps
a8ed1cd5 Add variable is_uniform_run to EGS_IO structure
3acb191c Update Mortran apps for uniform run control
a868291c Improve SPRRZnrc for parallel jobs
f4f6e356 Tune egs_utilities.mortran for uniform run control
c59d015d Tune egs_parallel.mortran for uniform run control
20c9dfb6 Update egsnrc.macros for uniform run control
3a222f8a Improve output messages for the spherical geometry
ff7a2893 Add sleep option to stagger SGE job submission
2d72f39d Add script to submit jobs on Sun Grid Engine
dc4e55fd Improve the description of run control objects
3f2f1b82 Change the urco default to check finished jobs
3901664c Add environment variable for density corrections
5cbc8fc8 Increase maximum number of jobs to 8192
c4c2fe76 Implement a uniform run control object
8a7311f5 Strip non-alphanumeric lead chars in PBS job name
8df47161 Fix pbsdsh jobnames starting with a period
58b6cd23 Detect failure to launch pbs job in egs-egs_parallel

         ( 900 lines... )

b6fe81a9 Fix missing comment quote
8e9a08fa Port utils files to github and AGPL-3.0
e255618f Move statement about file revision history
0dcc8d18 Adjust file header format
f9b27b1d Adjust file header format
874f1cb6 Merge branch 'master' of github.com:nrc-cnrc/EGSnrc
9327c077 Port egsnrc source files to github and AGPL-3.0
9990f5c2 Update readme
bbe98a8e Update readme
0ec55e41 Add markdown version of the AGPL-3.0
bb7a404d Port mortran3 files to github
cdab6a2c Port EGSnrc makefiles to github and AGPL 3.0
48fc752f Port EGSnrc cutils files to github
12b0db6b Update README.md
8ee6494f Update README.md
c9956542 Update README.md
e1e03b7b Update README.md
9f4b07de Create LICENCE
9456bc34 Update README.md
4534cdd4 Initial commit

avoid this !

Write a short (50 characters) informative commit title

Jorge Cham,  phdcomics.com

The key to useful version control is the log

log messages

$ git log --oneline

a6fc389c Merge #685: develop into master for 2021 release
7b7b9a5b Fix documentation warnings, links, tags, year
78e8745d Tweak README and add links to EGSnrc Discussions
60110c9a Bring 'develop' branch up to date with 'master'
7cfc660c Merge additional small stuff before release 2021
7a478e9f Update README to match EGSnrc web page
7a190b0d Update copyright years and fix duplicate reference
fd24a3fe Merge #684: small stuff for the 2021 release
8a0bcb40 Clarify notation for slab input in xyz geometry
58478a2c Fix loop index compiler warning in egs_cylinders.h
d17c479a Fix typo in egs_kerma documentation
b814bb3a Adjust format, typos, comments, docs, etc.
f57d3dbb Add a comment in getting-started about mingw
2030db2e Fix n_split equation in DOSXYZnrc documentation
30d10d19 Change Google+ community reference to reddit
d2ec76e0 Merge #588: run parallel jobs without a lock file
02258354 Run C preprocessor on Mortran apps to parse #ifdef
b08afa94 Remove -j12 option for testing in CI pipeline
c71955df Adjust eol spaces, remove leftover merge markers
5c4f81e0 Merge #683: add egs++ lattice geometry (see #561)
9b942fc1 Adjust headers, add citation pages and reflow
9edf97df Add egs_lattice geometry to the egs++ Makefile
77664e05 Add a reference to the egs_lattice paper
e91e2c41 Document the egs_lattice geometry variables
cc6d2100 Add egs_lattice geometry and sample input file
c778e2a7 Merge #628: add new set of egs-parallel scripts
01b86ac0 Add command to get thread count on Darwin system
66fea4bc Fix timing and atomic relaxations in CAVRZnrc
da12bc0c Preserve information after DOSXYZnrc parallel run
7ab5e620 Fix lock file errors when using a BEAMnrc library
67d4608d Check uniform RCO job termination in Motran apps
cc477746 Fix total ncase for the job control file object
3910e125 Add -u (--urc) run control option to egs++ apps
a8ed1cd5 Add variable is_uniform_run to EGS_IO structure
3acb191c Update Mortran apps for uniform run control
a868291c Improve SPRRZnrc for parallel jobs
f4f6e356 Tune egs_utilities.mortran for uniform run control
c59d015d Tune egs_parallel.mortran for uniform run control
20c9dfb6 Update egsnrc.macros for uniform run control
3a222f8a Improve output messages for the spherical geometry
ff7a2893 Add sleep option to stagger SGE job submission
2d72f39d Add script to submit jobs on Sun Grid Engine
dc4e55fd Improve the description of run control objects
3f2f1b82 Change the urco default to check finished jobs
3901664c Add environment variable for density corrections
5cbc8fc8 Increase maximum number of jobs to 8192
c4c2fe76 Implement a uniform run control object
8a7311f5 Strip non-alphanumeric lead chars in PBS job name
8df47161 Fix pbsdsh jobnames starting with a period
58b6cd23 Detect failure to launch pbs job in egs-egs_parallel

         ( 900 lines... )

b6fe81a9 Fix missing comment quote
8e9a08fa Port utils files to github and AGPL-3.0
e255618f Move statement about file revision history
0dcc8d18 Adjust file header format
f9b27b1d Adjust file header format
874f1cb6 Merge branch 'master' of github.com:nrc-cnrc/EGSnrc
9327c077 Port egsnrc source files to github and AGPL-3.0
9990f5c2 Update readme
bbe98a8e Update readme
0ec55e41 Add markdown version of the AGPL-3.0
bb7a404d Port mortran3 files to github
cdab6a2c Port EGSnrc makefiles to github and AGPL 3.0
48fc752f Port EGSnrc cutils files to github
12b0db6b Update README.md
8ee6494f Update README.md
c9956542 Update README.md
e1e03b7b Update README.md
9f4b07de Create LICENCE
9456bc34 Update README.md
4534cdd4 Initial commit

avoid this !

Write a short (50 characters) informative commit title

Jorge Cham,  phdcomics.com

The key to useful version control is the log

log messages

$ git log --oneline

a6fc389c Merge #685: develop into master for 2021 release
7b7b9a5b Fix documentation warnings, links, tags, year
78e8745d Tweak README and add links to EGSnrc Discussions
60110c9a Bring 'develop' branch up to date with 'master'
7cfc660c Merge additional small stuff before release 2021
7a478e9f Update README to match EGSnrc web page
7a190b0d Update copyright years and fix duplicate reference
fd24a3fe Merge #684: small stuff for the 2021 release
8a0bcb40 Clarify notation for slab input in xyz geometry
58478a2c Fix loop index compiler warning in egs_cylinders.h
d17c479a Fix typo in egs_kerma documentation
b814bb3a Adjust format, typos, comments, docs, etc.
f57d3dbb Add a comment in getting-started about mingw
2030db2e Fix n_split equation in DOSXYZnrc documentation
30d10d19 Change Google+ community reference to reddit
d2ec76e0 Merge #588: run parallel jobs without a lock file
02258354 Run C preprocessor on Mortran apps to parse #ifdef
b08afa94 Remove -j12 option for testing in CI pipeline
c71955df Adjust eol spaces, remove leftover merge markers
5c4f81e0 Merge #683: add egs++ lattice geometry (see #561)
9b942fc1 Adjust headers, add citation pages and reflow
9edf97df Add egs_lattice geometry to the egs++ Makefile
77664e05 Add a reference to the egs_lattice paper
e91e2c41 Document the egs_lattice geometry variables
cc6d2100 Add egs_lattice geometry and sample input file
c778e2a7 Merge #628: add new set of egs-parallel scripts
01b86ac0 Add command to get thread count on Darwin system
66fea4bc Fix timing and atomic relaxations in CAVRZnrc
da12bc0c Preserve information after DOSXYZnrc parallel run
7ab5e620 Fix lock file errors when using a BEAMnrc library
67d4608d Check uniform RCO job termination in Motran apps
cc477746 Fix total ncase for the job control file object
3910e125 Add -u (--urc) run control option to egs++ apps
a8ed1cd5 Add variable is_uniform_run to EGS_IO structure
3acb191c Update Mortran apps for uniform run control
a868291c Improve SPRRZnrc for parallel jobs
f4f6e356 Tune egs_utilities.mortran for uniform run control
c59d015d Tune egs_parallel.mortran for uniform run control
20c9dfb6 Update egsnrc.macros for uniform run control
3a222f8a Improve output messages for the spherical geometry
ff7a2893 Add sleep option to stagger SGE job submission
2d72f39d Add script to submit jobs on Sun Grid Engine
dc4e55fd Improve the description of run control objects
3f2f1b82 Change the urco default to check finished jobs
3901664c Add environment variable for density corrections
5cbc8fc8 Increase maximum number of jobs to 8192
c4c2fe76 Implement a uniform run control object
8a7311f5 Strip non-alphanumeric lead chars in PBS job name
8df47161 Fix pbsdsh jobnames starting with a period
58b6cd23 Detect failure to launch pbs job in egs-egs_parallel

         ( 900 lines... )

b6fe81a9 Fix missing comment quote
8e9a08fa Port utils files to github and AGPL-3.0
e255618f Move statement about file revision history
0dcc8d18 Adjust file header format
f9b27b1d Adjust file header format
874f1cb6 Merge branch 'master' of github.com:nrc-cnrc/EGSnrc
9327c077 Port egsnrc source files to github and AGPL-3.0
9990f5c2 Update readme
bbe98a8e Update readme
0ec55e41 Add markdown version of the AGPL-3.0
bb7a404d Port mortran3 files to github
cdab6a2c Port EGSnrc makefiles to github and AGPL 3.0
48fc752f Port EGSnrc cutils files to github
12b0db6b Update README.md
8ee6494f Update README.md
c9956542 Update README.md
e1e03b7b Update README.md
9f4b07de Create LICENCE
9456bc34 Update README.md
4534cdd4 Initial commit

avoid this !

Write a short (50 characters) informative commit title

inital commit on
28th November 2012

Jorge Cham,  phdcomics.com

Follow the “seven rules” for commit messages

log messages

$ git log

commit 697301d6
Author: Ernesto <ernesto.mainegra-hing@nrc-cnrc.gc.ca>
Date:   Thu Jan 28 18:05:34 2021 -0500

    Fix #661: flag Rayleigh photons as scattered

    Include Rayleigh photons as part of the scattered dose component in
    DOSRZnrc, using the patch provided by @dworogers. Also adjust comment
    lines that were longer than 80 characters.

commit 3fa9be78
Author: Frederic Tessier <ftessier@gmail.com>
Date:   Tue Dec 15 11:00:48 2020 -0500

    Fix command to get file size in configure script

    Use 'wc -c' to obtain the number of bytes in the temporary file when
    determining the Fortran record length during EGSnrc configuration. The
    problem with 'stat -c' is that it is not standard; for example, there is
    no '-c' option in BSD variants (macOS). Using the 'stat' command is
    a regression introduced in issue #616 to remove a dependency on the
    format of the 'ls' output.

commit 7247e188
Author: Reid Townson <rwtownson@gmail.com>
Date:   Wed Aug 19 16:23:05 2020 -0400

    Add splitting var in egs_chamber to replace latch

    Use a dedicated splitting variable nbr_split, instead of latch, to hold
    the splitting number in the egs_chamber application. A new stack
    variable nbr_splitting is added to pass its value through the EGSnrc
    back end. This avoids overwriting the latch variable in cases where it
    is needed otherwise, for example in the phsp scoring object. Ideally,
    the meaning of latch should remain consistent with BEAMnrc.
    
(966 commits...)

commit 4534cdd4
Author: ftessier <ftessier@gmail.com>
Date:   Wed Nov 28 11:26:41 2012 -0800

    Initial commit

Chris Beams, @cbeams, https://cbea.ms/git-commit/

The seven rules of a great
git commit message

Keep in mind: this has all been said before

Follow the “seven rules” for commit messages

log messages

$ git log

commit 697301d6
Author: Ernesto <ernesto.mainegra-hing@nrc-cnrc.gc.ca>
Date:   Thu Jan 28 18:05:34 2021 -0500

    Fix #661: flag Rayleigh photons as scattered

    Include Rayleigh photons as part of the scattered dose component in
    DOSRZnrc, using the patch provided by @dworogers. Also adjust comment
    lines that were longer than 80 characters.

commit 3fa9be78
Author: Frederic Tessier <ftessier@gmail.com>
Date:   Tue Dec 15 11:00:48 2020 -0500

    Fix command to get file size in configure script

    Use 'wc -c' to obtain the number of bytes in the temporary file when
    determining the Fortran record length during EGSnrc configuration. The
    problem with 'stat -c' is that it is not standard; for example, there is
    no '-c' option in BSD variants (macOS). Using the 'stat' command is
    a regression introduced in issue #616 to remove a dependency on the
    format of the 'ls' output.

commit 7247e188
Author: Reid Townson <rwtownson@gmail.com>
Date:   Wed Aug 19 16:23:05 2020 -0400

    Add splitting var in egs_chamber to replace latch

    Use a dedicated splitting variable nbr_split, instead of latch, to hold
    the splitting number in the egs_chamber application. A new stack
    variable nbr_splitting is added to pass its value through the EGSnrc
    back end. This avoids overwriting the latch variable in cases where it
    is needed otherwise, for example in the phsp scoring object. Ideally,
    the meaning of latch should remain consistent with BEAMnrc.
    
(966 commits...)

commit 4534cdd4
Author: ftessier <ftessier@gmail.com>
Date:   Wed Nov 28 11:26:41 2012 -0800

    Initial commit

Chris Beams, @cbeams, https://cbea.ms/git-commit/

Keep in mind: this has all been said before

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line

The seven rules of a great
git commit message

Follow the “seven rules” for commit messages

log messages

$ git log

commit 697301d6
Author: Ernesto <ernesto.mainegra-hing@nrc-cnrc.gc.ca>
Date:   Thu Jan 28 18:05:34 2021 -0500

    Fix #661: flag Rayleigh photons as scattered

    Include Rayleigh photons as part of the scattered dose component in
    DOSRZnrc, using the patch provided by @dworogers. Also adjust comment
    lines that were longer than 80 characters.

commit 3fa9be78
Author: Frederic Tessier <ftessier@gmail.com>
Date:   Tue Dec 15 11:00:48 2020 -0500

    Fix command to get file size in configure script

    Use 'wc -c' to obtain the number of bytes in the temporary file when
    determining the Fortran record length during EGSnrc configuration. The
    problem with 'stat -c' is that it is not standard; for example, there is
    no '-c' option in BSD variants (macOS). Using the 'stat' command is
    a regression introduced in issue #616 to remove a dependency on the
    format of the 'ls' output.

commit 7247e188
Author: Reid Townson <rwtownson@gmail.com>
Date:   Wed Aug 19 16:23:05 2020 -0400

    Add splitting var in egs_chamber to replace latch

    Use a dedicated splitting variable nbr_split, instead of latch, to hold
    the splitting number in the egs_chamber application. A new stack
    variable nbr_splitting is added to pass its value through the EGSnrc
    back end. This avoids overwriting the latch variable in cases where it
    is needed otherwise, for example in the phsp scoring object. Ideally,
    the meaning of latch should remain consistent with BEAMnrc.
    
(966 commits...)

commit 4534cdd4
Author: ftessier <ftessier@gmail.com>
Date:   Wed Nov 28 11:26:41 2012 -0800

    Initial commit

Chris Beams, @cbeams, https://cbea.ms/git-commit/

Keep in mind: this has all been said before

  1. Wrap the message lines at 72 characters
  2. Use the body to explain what and why vs. how

The seven rules of a great
git commit message

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line

Follow the “seven rules” for commit messages

log messages

$ git show 697301d6

commit 697301d6
Author: Ernesto <ernesto.mainegra-hing@nrc-cnrc.gc.ca>
Date:   Thu Jan 28 18:05:34 2021 -0500

    Fix #661: flag Rayleigh photons as scattered

    Include Rayleigh photons as part of the scattered dose component in
    DOSRZnrc, using the patch provided by @dworogers. Also adjust comment
    lines that were longer than 80 characters.

diff --git a/HEN_HOUSE/user_codes/dosrznrc/dosrznrc.mortran b/HEN_HOUSE/user_codes/dosrznrc/dosrznrc.mortran
index 2abb1ff..a4d4856 100644
--- a/HEN_HOUSE/user_codes/dosrznrc/dosrznrc.mortran
+++ b/HEN_HOUSE/user_codes/dosrznrc/dosrznrc.mortran
@@ -1358,8 +1358,8 @@ REPLACE {$VERSION} WITH {
 "  ESAVEIN             (R)  If ELECTRON RANGE REJECTION is on, discard an
 "                           electron  when E< ESAVEIN and RANGE < CDIST
 "                           where CDIST is closest distance to region of
-"                           interest specified below. This ignores bremsstrahlung
-"                           losses below ESAVEIN.
+"                           interest specified below (ignores bremsstrahlung
+"                           losses below ESAVEIN).
 "                           This parameter must be input even if not used.
 "                           ESAVEIN is a total energy.
 "
@@ -2583,6 +2583,7 @@ IF(IFULL = 1 | IFULL = 3 | IKERMA = 1) [
     iausfl(19) = 1; "after compt"
     iausfl(20) = 1; "before photo"
     iausfl(21) = 1; "after photo"
+    iausfl(25) = 1; "after Rayleigh"
     iausfl(32) = 1; "before eii"
     iausfl(33) = 1; "after eii"
     iausfl(34) = 1; "after sub-threshold fluorescent photon discarded"

Chris Beams, @cbeams, https://cbea.ms/git-commit/

Keep in mind: this has all been said before

  1. Wrap the message lines at 72 characters
  2. Use the body to explain what and why vs. how

The seven rules of a great
git commit message

  1. Separate subject from body with a blank line
  2. Limit the subject line to 50 characters
  3. Capitalize the subject line
  4. Do not end the subject line with a period
  5. Use the imperative mood in the subject line

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

git stage

+

work

+

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

git stage

git commit

+

work

+

9456bc3

.git/

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

git commit

work

work
some more

+

git stage

+

+

9456bc3

.git/

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

work

work
some more

235f0f1

+

9456bc3

git commit

git stage

+

+

.git/

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

work

work
some more

235f0f1

git commit

git stage

+

4407e0b

+

+

9456bc3

.git/

git trades a little overhead for robust version control 

Your new workflow to manage documents: start today!

mypaper/

.git/

git init

work

work
some more

235f0f1

git commit

git stage

+

4407e0b

+

9456bc3

94583fc

.git/

accuracy
precision
comparison
reproducibility
accountability
documentation

Example: checking modifications 

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM,

Frédéric Meynadier  BIPM

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM

Frédéric Meynadier  BIPM

BIPM Ionizing Radiation Department  GitHub repository

BIPM Time Department  GitLab instance

Install git: this is easy!

Linux

$ sudo apt install git-all    # on systems relying on .deb packages
$ sudo yum install git-all    # on systems relying on .rpm packages

macOS

$ git --version    # if not installed, will prompt to install it

Windows

1. Download installer: https://gitforwindows.org/
2. Open the Git BASH application to run terminal git commands.

There are dozens of guis for git

Visual Studio Code

gitk

GitHub Desktop

Sourcetree

GitKraken

Tell git who you are: git config

  • Specify a name and email that will be associated with your commits.
    This is essential for collaborative work and public repositories.
$ git config --global user.name "Firstname Lastname" 
$ git config --global user.email "firstname.lastname@email.com"
  • You can inspect your git configuration variables at any time:
$ git config --list
            
user.email=firstname.lastname@email.com
user.name=Firstname Lastname
core.editor=vim
core.autocrlf=input
log.abbrevcommit=true
color.ui=auto
init.defaultbranch=main

Create a repository: git init

  • Create a new directory for our project:

$ mkdir myproject
  • Go inside that directory and initialize git:
$ cd myproject/
$ git init
Initialized empty Git repository in /home/user/myproject/.git/
  • The hidden .git directory is the repository (don’t remove it!)
$ ls -al
total 0
drwxr-xr-x   3 user  staff    96  7 Feb 10:58 .
drwxr-xr-x  63 user  staff  2016  7 Feb 10:57 ..
drwxr-xr-x   9 user  staff   288  7 Feb 10:58 .git

myproject/

.git/

Check the current state of the project: git status

  • Check the status of our new, empty repository:
$ git status
On branch main

No commits yet

nothing to commit (create/copy files and use "git stage" to track)
  • After creating a new file myproject/myfile.txt:
$ git status
On branch main

No commits yet

Untracked files:
  (use "git stage <file>..." to include in what will be committed)
        myfile.txt

nothing added to commit but untracked files present (use "git stage" to track)

reminders in the status

git ignores untracked files

  • We must add files to the repository explicitly. By default, new files
    are untracked (ignored by git).

+

Stage changes to build a commit: git stage (git add)

  • Creating a commit involves two steps:

+

working “tree”

myproject/

Stage changes to build a commit: git stage (git add)

  1. Stage new files (or file modifications) to start building a new commit:
$ git stage myfile.txt

$ git status
On branch main

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   myfile.txt
  • Creating a commit involves two steps:

stage

working “tree”

myproject/

git stage

+

reminder of command to unstage

Record the commit in the repository: git commit

  1. When our commit is ready, we record it in the repository:
$ git commit -m "Initial commit"
[main (root-commit) b753721] Initial commit
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 myFile.txt
 
$ git status
On branch main
nothing to commit, working tree clean

stage

working “tree”

myproject/

+

repository

myproject/.git/

git commit

-m “Commit message”
 (or git opens a text editor)

  • Creating a commit involves two steps:

git stage

Find out what has changed: git diff

  • For each file, differences are displayed, line by line in “diff” format:
$ echo "Here is my change" >> myfile.txt

$ git diff
diff --git a/myfile.txt b/myfile.txt
index e69de29..7381106 100644
--- a/myfile.txt
+++ b/myfile.txt
@@ -0,0 +1 @@
+Here is my change.
$ git diff --name-status
M       myfile.txt
  • Many output options are available, here for example a more concise one:
  • It is possible to compare any two commits in the repository by specifying two commit references (hashes, branch names, etc.), for example:
$ git diff e69de29 7381106    # any two commit references (here two commit hashes)

the difference between the current working
copy and what is stored in the repository (.git/)

Revisit history: git log

  • The log only lists the commits (not the working or staged changes):
$ git log
commit b753721
Author: Reid Townson <myemail@email.com>
Date:   Thu Nov 25 14:40:00 2021 -0500

    Initial commit
$ git stage myfile.txt                                              # stage changes
$ git commit -m "Insert a line to illustrate a modification"        # commit them

$ git log
commit b48f500
Author: Reid Townson <myemail@email.com>
Date:   Fri Dec 10 12:31:37 2021 -0500

    Insert a line to illustrate a modification

commit b753721
Author: Reid Townson <myemail@email.com>
Date:   Thu Nov 25 14:40:00 2021 -0500

    Initial commit
  • Stage and commit our change, and see it appear in the log:

useful to find commit hashes of older commits!

Collaborate: host a repository on github.com

EGSnrc/

.git/

Pick your hosting service: github.com, gitlab.com, bitbucket.org.

Duplicate a repository: git clone

EGSnrc/

.git/

$ git clone https://github.com/nrc-cnrc/EGSnrc.git
Cloning into 'EGSnrc'...
remote: Enumerating objects: 13850, done.
remote: Counting objects: 100% (141/141), done.
remote: Compressing objects: 100% (125/125), done.
remote: Total 13850 (delta 57), reused 49 (delta 16), pack-reused 13709
Receiving objects: 100% (13850/13850), 54.38 MiB | 2.27 MiB/s, done.
Resolving deltas: 100% (9215/9215), done.
Updating files: 100% (2448/2448), done.

Cloning means duplicating the repository locally, including the entire history, branches, etc.

Send changes to the remote: git push

  • Repositories you are linked to are called remotes. To view these links: 
$ cd myproject/
$ git remote -v
origin	https://github.com/myname/myproject.git (fetch)
origin	https://github.com/myname/myproject.git (push)
$ git push origin
Enter passphrase for key '/home/myname/.ssh/id_rsa':
...
To github.com:myname/myproject.git
   b680987..ffa4138  main -> main
  • After making local changes, you can push them to the “origin” remote:
$ git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
  • As always, check the status to confirm:

a remote can be any URL

Receive changes from the remote: git pull

  • If there are new commits in the remote, we need to update the local repo:
$ git pull
...
From github.com:myname/myproject
   ffa4138..a9700ea  main       -> origin/main
Updating ffa4138..a9700ea
Fast-forward
 myFile.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
$ git pull
Auto-merging myFile.txt
CONFLICT (content): Merge conflict in myFile.txt
Automatic merge failed; fix conflicts and then commit the result.
  • If there are merge conflicts, git asks you to fix them manually:

a summary of the changes that were pulled in the local repo

  • Resolving conflicts is an advanced topic. To cancel the entire pull operation at this point, issue the command: 

git merge --abort

git data flow cheat sheet 

stage

working “tree”

local repo

remote repo

.git/

git stage

git commit

git push

git pull

git fetch

git merge

We surveyed the basic git operations

  • init
  • status
  • stage
  • commit
  • diff
  • log
  • clone
  • push
  • pull

All the advanced topics are easier to grasp once you
figure out the basics: what a commit is, how git operates.

Basic concepts

  • branches
  • remotes
  • tags
  • searching
  • merging
  • rebasing
  • resolving conflicts
  • resetting
  • cherry-picking
  • interactive staging
  • cleaning, rewriting history
  • submodules
  • git workflows
  • set up an internal git server
  • ...

More advanced topics

Introduction

Theory

Method

Results

a

b

c

d

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Romain Coulon  BIPM

Frédéric Meynadier  BIPM

BIPM Ionizing Radiation Department  GitHub repository

BIPM Time Department  GitLab instance

Introduction

Theory

Method

a

b

c

Massimo Pinto  ENEA-INMRI, Italy

Frédéric Tessier  NRC, Canada

Reid Townson  NRC, Canada

Contributions

Massimo Pinto explained how version control promotes file management that is robust, reliable, and how it enables collaboration and open science.

Frédéric Tessier articulated a fundamental picture of the git philosophy and its inner workings, to accelerate the learning of git concepts and git operations.

Reid Townson taught the basic git commands with practical examples so that you can start managing your individual or collaborative projects with git right away.

Romain Coulon and Frédéric Meynadier showcased two real-life scenarios at the BIPM where git is enabling a project management approach that complies de facto with ISO 17025 principles. 

In ISO/IEC 17025:2017

“7.5.2 The laboratory shall ensure that amendments to technical records can be tracked to previous versions or to original observations. Both the original and amended data and files shall be retained, including the date of alteration, an indication of the altered aspects and the personnel responsible for the alterations.