-
Notifications
You must be signed in to change notification settings - Fork 234
Using Git for SPECFEM
Table of Contents
- One time configurations for all repositories
- One-time configuration for each repository
- Regular daily usage
- If you do not already have one, you will need to open a free account at https://github.com. In order to become a contributor / developer for SPECFEM you do NOT need to create any account on our Web site nor to get access rights from us, the only thing you will need is a GitHub account.
-
Install the package called
ruby
using your package manager or any other suitable method (for instance on Linux Ubuntu machines you can typesudo apt-get install ruby
orsudo yum install ruby
or similar) -
Install the package called
rake
using your package manager or any other suitable method (for instance on Linux Ubuntu machines you can typesudo apt-get install rake
orsudo yum install rake
or similar) -
On some Linux systems (for instance Red Hat Linux) you will need to type
sudo yum install rubygem-rake-compiler
or similar instead to install the two above packages -
Install the package called
libopenssl-ruby
using your package manager or any other suitable method (for instance on Linux Ubuntu machines you can typesudo apt-get install libopenssl-ruby
orsudo yum install libopenssl-ruby
or similar) -
Download the package called
hub
:$ git clone https://github.com/github/hub.git
-
Install
hub
somewhere in yourPATH
, e.g. in~/bin
:$ mkdir -p ~/bin $ cd hub $ rake install prefix=~/bin $ cd ~/bin $ ln -s bin/hub
-
Permanently alias
git
tohub
. Put it in your.bashrc
. Make sure the path where you have installedhub
is executable and is in yourPATH
.$ alias git='hub'
-
Copy/paste the following script in
~/bin/config_repo
#!/bin/bash # Set configuration for github. # Configuration is saved in .git/config ARGS=1 if [ $# -ne $ARGS ] || [ $1 == "-help" ] then echo "usage: config_repo your_github_user_name " exit 0; fi GITHUB_USER=$1 GITVERSIONMAJOR=`git --version | head -1 | cut -f 3 -d " " | cut -c 1` GITVERSIONMINOR=`git --version | head -1 | cut -f 3 -d " " | cut -c 3` if [[ "$GITVERSIONMAJOR" -eq 0 || ("$GITVERSIONMAJOR" -eq 1 && "$GITVERSIONMINOR" -le 7) ]]; then echo "git version >= 1.8 is needed for the scripts to work, but you have" git --version echo "please install git version >= 1.8 and try again" exit -1 fi git config --global url."https://".insteadOf git:// git config branch.master.remote origin git config branch.master.merge master git config branch.master.pushremote $GITHUB_USER git config branch.devel.remote origin git config branch.devel.merge devel git config branch.devel.pushremote $GITHUB_USER git config push.default current git remote set-head origin devel
-
Make it executable
$ chmod u+x ~/bin/config_repo
-
Clone the repository on your machine (
VERY IMPORTANT
: in what follows the example is given forspecfem3d
, but you can replace that withspecfem2d
orspecfem3d_globe
if you want to use any of the other two packages)$ git clone geodynamics/specfem3d
-
Checkout the
devel
branch$ cd specfem3d $ git checkout -b devel origin/devel
-
Call our configuration script
$ config_repo your_github_name
-
If (and only if) calling our configuration script gives you an error message telling you that you have an old version of Git and that you need to install Git version 1.8 or above instead, you can do this to install Git version 1.8 (and then try to run the configuration script again):
First (that is optional on some systems) you will need the following packages to be installed (they might already be installed, they are fairly common):
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
or
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev ssh expat zlib1g zlib1g-dev tk python
and then, to install the new version of Git from its source code, type this:
cd $HOME
mkdir bin/git src
cd src
git clone git://git.kernel.org/pub/scm/git/git.git
sudo apt-get remove git-core
cd git
make prefix=/usr/local all
sudo make install prefix=/usr/local
-
create a fork (a copy of the repository on your GitHub account) (do this only once, i.e. if you are using several computers, each with a copy of the code, then run "git fork" on the first machine only, no need to do it when you create copies on the other machines later)
$ git fork
-
update your copy of the repository
$ git pull
-
make some changes to any file you want using your favorite editor (in the line below we use
vi
as an example)$ vi some_file.f90
-
commit your changes locally, adding a very short message (one line) explaining what you have changed
$ git commit -a -m "Explain your commit"
-
(optional) if you want to check what has changed (and thus what will be committed) before typing the
git commit
above, you can type one or both of these two commands:$ git status -s $ git diff
-
push your changes to your GitHub fork
$ git push
-
Create a pull-request to get your changes into the main repository (this is needed only once for each change; if you are fixing an existing change after receiving an error message from our BuildBot code-consistency checking system, you need the "git push" above again but you do NOT need to create a pull request a second time)
$ git pull-request
Note (optional): It is not strictly necessary to create a pull request for every commit you make if you do not want to, you can safely submit pull requests after making a few commits instead if you prefer. However, it also does not hurt to do so.
Development wiki for SPECFEM3D
Development wiki
- Home
- Development plan
- Best Practices
- Using Git for SPECFEM
- Advanced Git Topics
- Versioning Conventions
- Merging Development Branches into Master
User manual
- 01_introduction
- 02_getting_started
- 03_mesh_generation
- 04_creating_databases
- 05_running_the_solver
- 06_fault_sources
- 07_adjoint_simulations
- 08_doing_tomography
- 08b_performing_full_waveform_inversion_FWI_or_source_inversions
- 09_noise_simulations
- 10_gravity_calculations
- 11_graphics
- 12_running_scheduler
- 13_changing_the_model
- 14_post_processing
- 15_informations_for_developers
- A_reference_frame
- B_channel_codes
- C_troubleshooting
- D_license
- authors
- bug_reports
- copyright_and_version
- features
- manual_SPECFEM3D_Cartesian
- notes_and_acknowledgement
- sponsors