Git: Difference between revisions
No edit summary |
No edit summary |
||
Line 25: | Line 25: | ||
=== Obtaining dynlib === | === Obtaining dynlib === | ||
# The official source code repository resides in Thomas' user directory. The <code>clone</code>command copies the entire repository into a dynlib folder in your current working directory. | # The official source code repository resides in Thomas' user directory. The <code>clone</code> command copies the entire repository into a dynlib folder in your current working directory. | ||
#:<code>git clone /Data/gfi/users/tsp065/lib/dynlib.git</code> | #:<code>git clone /Data/gfi/users/tsp065/lib/dynlib.git</code> | ||
# Change into the dynlib folder. | # Change into the dynlib folder. | ||
Line 42: | Line 42: | ||
Let's assume the user <code>tsp065</code> has coded some very interesting routines that have however not yet found thier way in the official respository. | Let's assume the user <code>tsp065</code> has coded some very interesting routines that have however not yet found thier way in the official respository. | ||
#Then, if <code>tsp065</code> followed the instructions in the [[#Developing dynlib]] section, you can add Thomas' repository as one of your '' | #Then, if <code>tsp065</code> followed the instructions in the [[#Developing dynlib]] section, you can add Thomas' repository as one of your ''remote repositories'' by | ||
#:<code>git | #:<code>git remote add thomas /Data/gfi/users/tsp065/lib/dynlib_tsp065.git</code> | ||
#:The name <code>thomas</code> is an aribtrary name for the | #:The name <code>thomas</code> is an aribtrary name for the remote repository. | ||
# Then you can fetch updates from Thomas' respository just like from the official one. | # Then you can fetch updates from Thomas' respository just like from the official one. | ||
#:<code>git pull thomas</code> | #:<code>git pull thomas</code> | ||
Line 51: | Line 51: | ||
== Developing dynlib == | == Developing dynlib == | ||
=== Locally saving your changes === | |||
Suppose you have edited some of the Fortran95 source code files, and want to save and share them. | |||
# Then first you have to commit the new version into your local development repository. | |||
#:<code>git commit -a</code> | |||
#:Give a sensible and brief description of your changes in the editor that is opened (automatically) | |||
=== Setup of your personal publicly shared repository === | |||
# Creating a ''bare'' repository for sharing. | |||
#:<code>git clone . /Data/gfi/users/tsp065/lib/dynlib_<your-ID>.git</code> | |||
# It is convenient to again setup a named ''remote repository''. | |||
#:<code>git remote add own /Data/gfi/users/tsp065/lib/dynlib_<your-ID>.git</code> | |||
=== Sharing your changes === | |||
# Then you have to ''push'' your new version to a repository that other people can read. | |||
#:<code>git push own</code> |
Revision as of 15:54, 15 January 2013
The development of Bedymo and Dynlib is coordinated with the version control system git. git is a distributed version control system in that there is no central repository required, as would be for older systems like svn (subversion) or cvs. Any central repository is only central by convention.
Background
Common ideas all version control systems
All version control systems store the history of a set of files and directories in a repository, and are able to restore the file as it used to be in a previous version. In addition to the actual changes in the file(s) all systems also keep meta-information like the editing user, the date and time of the changes as well as a small description of the changes. The development of the project is tracked through commits, which creates and stores a new version or revision of all changed files.
Distributed version control
In a distributed version control system like git, there is no central repository. Every copy of the repository is technically equal, and is equally able to crate new versions. In a non-distributed version control system, only the central repository residing on a (publicly available) server is able to create new versions. Hence, you need connection to that server to be able to commit changes.
Advantages of distributed version control
Apart from the ability to track changes and view the entire history of the project also when offline (on a cruise, plane, conference or summer school with limited connectivity) the main advantage of distributed version control systems lies in the handling of branches.
Disadvantages of distributed version control
The added flexibility of a distributed system comes at the cost of loosing an intuitive way to address the different revisions. Using a central repository, one simply increases an internal revision counter, such that revision 765 supersedes revision 764. Without a central repository there is noone that could assign those kind of numbers. git uses the SHA1-hash of the commited files as an identifier for the revision, e.g. something like bbe0e301cb39b597a49b3819ccf8b0d08d817d2e
. One need however only type the first couple of symbols until the identifier becomes unique. In this example taken from dynlib, bbe0
is enough to uniquely identify the revision. In addition one can always manually assign human-friendlier names such as gamma-0.4.2
for the above revision.
Usage for Bedymo and Dynlib
All instructions are shown here for dynlib. The setup for bedymo is indentical, so that you need only replace dynlib by bedymo to obtain the corresponding command for bedymo.
Obtaining dynlib
- The official source code repository resides in Thomas' user directory. The
clone
command copies the entire repository into a dynlib folder in your current working directory.git clone /Data/gfi/users/tsp065/lib/dynlib.git
- Change into the dynlib folder.
cd dynlib
- Compile the library.
./compile
Updating dynlib
- The repository you cloned from is saved in the git configuration as
origin
designating your source repository. That's where the following command fetches updates from.git pull
- Re-Compile the library.
./compile
Fetching updates by some other user
Let's assume the user tsp065
has coded some very interesting routines that have however not yet found thier way in the official respository.
- Then, if
tsp065
followed the instructions in the #Developing dynlib section, you can add Thomas' repository as one of your remote repositories bygit remote add thomas /Data/gfi/users/tsp065/lib/dynlib_tsp065.git
- The name
thomas
is an aribtrary name for the remote repository.
- Then you can fetch updates from Thomas' respository just like from the official one.
git pull thomas
- Re-Compile the library.
./compile
Developing dynlib
Locally saving your changes
Suppose you have edited some of the Fortran95 source code files, and want to save and share them.
- Then first you have to commit the new version into your local development repository.
git commit -a
- Give a sensible and brief description of your changes in the editor that is opened (automatically)
- Creating a bare repository for sharing.
git clone . /Data/gfi/users/tsp065/lib/dynlib_<your-ID>.git
- It is convenient to again setup a named remote repository.
git remote add own /Data/gfi/users/tsp065/lib/dynlib_<your-ID>.git
Sharing your changes
- Then you have to push your new version to a repository that other people can read.
git push own