MATH 676 Finite element methods in scientifjc computing Wolfgang - - PowerPoint PPT Presentation

math 676 finite element methods in scientifjc computing
SMART_READER_LITE
LIVE PREVIEW

MATH 676 Finite element methods in scientifjc computing Wolfgang - - PowerPoint PPT Presentation

MATH 676 Finite element methods in scientifjc computing Wolfgang Bangerth, T exas A&M University http://www.dealii.org/ Wolfgang Bangerth Lecture 32.75: Learning to use modern tools, part 5b: Version control systems (VCSs) Git


slide-1
SLIDE 1

http://www.dealii.org/ Wolfgang Bangerth

MATH 676 – Finite element methods in scientifjc computing

Wolfgang Bangerth, T exas A&M University

slide-2
SLIDE 2

http://www.dealii.org/ Wolfgang Bangerth

Lecture 32.75: Learning to use modern tools, part 5b: Version control systems (VCSs) Git

slide-3
SLIDE 3

http://www.dealii.org/ Wolfgang Bangerth

Git

Git has a different philosophy:

  • There is a repository somewhere
  • I create a local copy (“clone”) of it
  • I check out from and into my own clone
  • I can “pull” further changes from upstream (or another

repository)

  • I can “push” my locally committed changes into another

repository

slide-4
SLIDE 4

http://www.dealii.org/ Wolfgang Bangerth

Git

Advantages:

  • My own repository is like a branch
  • I can work offline
  • I can mix and match changes from different repositories
  • Branches are more “natural” in git than in subversion and

are used far more often

  • It seems to somehow work better with inexperienced

developers Disadvantages:

  • More difficult model (but there are many online tutorials)
slide-5
SLIDE 5

http://www.dealii.org/ Wolfgang Bangerth

Git

Terminology:

  • Subversion “mainline” –> git “master”
  • “origin” of repository B: by convention, the location of the

repository A from which B was cloned

  • “upstream” of repository B: by convention, the location

from which A itself was cloned

slide-6
SLIDE 6

http://www.dealii.org/ Wolfgang Bangerth

Git

Terminology:

  • In subversion one thinks of version N as the “state” of the

code after N revisions have been made

  • A commit results in a new version
  • In git one tries to avoid thinking of versions; rather, as a

collection of patches (i.e., “patch sets”)

  • A commit results in a new patch to be added to the

current branch (e.g. “master”)

slide-7
SLIDE 7

http://www.dealii.org/ Wolfgang Bangerth

Git

Conceptual differences: Revisions numbers etc.

  • In subversion, there is only one repository
  • We can enumerate all versions uniquely
  • In git, there are many repositories
  • None is superior to the others

(though projects designate an “official” repository)

  • Changes are moved from repository to repository
  • Revision numbers would no longer match between

repositories –> revisions are identified by hashes, versions are just patch sets

slide-8
SLIDE 8

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • In the beginning:

dealii.org

Using http://pcottle.github.io/learnGitBranching

slide-9
SLIDE 9

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • deal.II developers make another change on their master:

dealii.org

Using http://pcottle.github.io/learnGitBranching

slide-10
SLIDE 10

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • I “clone” the repository to my local harddrive and check
  • ut a copy:

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-11
SLIDE 11

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • Somebody commits further changes to “origin”:

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-12
SLIDE 12

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • I make and commit two changes to my local clone:

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-13
SLIDE 13

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • Note: c9 in the two repositories are different changes!

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-14
SLIDE 14

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • Consequence: If I want to contribute c9 and c10 to

“origin”(=dealii.org) they would have to get new numbers dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-15
SLIDE 15

http://www.dealii.org/ Wolfgang Bangerth

Git

The revision number problem:

  • (Sequential) Numbers cannot be unique between

repositories if no repository is “special”

  • Patches are identified by a 40-digit “hash”, e.g.:

525b8df065394c541d499cd6d62cf9485ec5038b

  • Most of the time, we refer to patches only by their first 7

digits: 525b8df

  • A hash is computed from:

– the ancestor of a patch – its content

  • Hashes could conflict, but this never happens in reality
slide-16
SLIDE 16

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • I want to contribute (“push”) my changes:

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-17
SLIDE 17

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • Step 1: Attach the two patches to their ancestor (c8)

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-18
SLIDE 18

http://www.dealii.org/ Wolfgang Bangerth

Git

Example for revision numbers/hashes:

  • Step 2: Merge the two changes past c9 to yield c12

dealii.org My clone

Using http://pcottle.github.io/learnGitBranching

slide-19
SLIDE 19

http://www.dealii.org/ Wolfgang Bangerth

Git

Let's see some of this in practice...

slide-20
SLIDE 20

http://www.dealii.org/ Wolfgang Bangerth

Git

Conceptual differences: The sanctity of the repository

  • In subversion, you never ever change anything that's

been committed before

  • In git, we do this all the time:

– Delete a previous patch – Combine patches – Reorder patches

  • We can do this on our local clone (typically to clean up

some detours in development)

  • You can never do this once you've published code to a

public repository

slide-21
SLIDE 21

http://www.dealii.org/ Wolfgang Bangerth

MATH 676 – Finite element methods in scientifjc computing

Wolfgang Bangerth, T exas A&M University