Edit Permissions

As a first step, contact Ken Brobeck brobeck@slac.stanford.edu and request access to:

/afs/slac/g/cd/swe/git/repos/slac/FACET

Location of Matlab repositories

Code for Matlab 2020a and beyond will be stored in Git repositories.

The location of all the "master" repositories for FACET-II is in AFS:

/afs/slac/g/cd/swe/git/repos/slac/FACET
The repository for Matlab files is here:
/afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git

The production version (on facet-srv0X) is here:

/usr/local/facet/tools/matlabTNG/

The repository is also mirrored on github here:

https://github.com/slaclab/facet-matlabTNG


Location of Python repositories

There are two locations with python/pydm code for FACET-II.

Most pydm GUIs can be found here:

/afs/slac/g/cd/swe/git/repos/slac/pydm_displays/user-facet.git

And on the controls network it is here:

/usr/local/facet/tools/pydm/display/user-facet/

Additional python repos for other experiments, including E320 can be found here:

/afs/slac/g/cd/swe/git/repos/slac/FACET/

Cloning the repo on facet-srv01

In your user directory, create a working directory ('git_work' in this example). Then execute the 'git clone' command:

[fphysics@facet-srv01 ~/sgess/git_work ]$ git clone ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git 
Initialized empty Git repository in /home/fphysics/sgess/git_work/matlabTNG/.git/
sgess@mcclogin's password: 
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[fphysics@facet-srv01 ~/sgess/git_work ]$ ls
matlabTNG


Cloning the repo on AFS (rhel6-64, lcls-dev3, et al)

In your user directory on AFS, create a working directory ('git_work' in this example). Then execute the 'git clone' command:

[sgess@rhel6-64a ~/sgess/git_work ]$ git clone /afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git 
Initialized empty Git repository in /u/at/sgess/git_work/matlabTNG/.git/
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (3/3), done.
[sgess@rhel6-64a ~/sgess/git_work ]$ ls
matlabTNG



Editing a file and pushing the changes

In this example, we will edit the file 'README.md'. Then we use 'git commit' to commit our changes and 'git push' to add them to the master repo:

Working in home workspace on production

[fphysics@facet-srv01 ~/sgess/git_work/matlabTNG ]$ vim README.md 
[fphysics@facet-srv01 ~/sgess/git_work/matlabTNG ]$ git commit -m "test commit from facet-srv01" README.md 
[master c2cb0c2] test commit from facet-srv01
 1 files changed, 2 insertions(+), 0 deletions(-)
[fphysics@facet-srv01 ~/sgess/git_work/matlabTNG ]$ git push origin master
sgess@mcclogin's password: 
Counting objects: 5, done.
Delta compression using up to 40 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 333 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git
   ffd224e..c2cb0c2  master -> master

Updating the production repo

Once you've pushed your changes to the master repo, they are not automatically updated in production. To do that:

[fphysics@facet-srv01 ~/sgess/git_work/matlabTNG ]$ cd /usr/local/facet/tools/matlabTNG/
[fphysics@facet-srv01 /usr/local/facet/tools/matlabTNG ]$ git pull
sgess@mcclogin's password: 
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From ssh:///afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG
   c2cb0c2..4cb81f7  master     -> origin/master
Updating c2cb0c2..4cb81f7
Fast-forward
 README.md |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-


Working in home workspace on AFS

[sgess@rhel6-64a ~/sgess/git_work/matlabTNG ]$ vim README.md 
[sgess@rhel6-64a ~/sgess/git_work/matlabTNG ]$ git commit -m "test commit from AFS" README.md 
[master c2cb0c2] test commit from AFS
 1 files changed, 2 insertions(+), 0 deletions(-)
[sgess@rhel6-64a ~/sgess/git_work/matlabTNG ]$ git push origin master
Counting objects: 5, done.
Delta compression using up to 40 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 333 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To /afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git
   ffd224e..c2cb0c2  master -> master


Syncing the AFS repo with GitHub

You need to have 'admin' privileges for the repo on GitHub for this to work. Matt Gibbs can grant priviliges.

Working from a directory that has access to SLAC AFS and GitHub

sgess@pc95258:~/git_work/matlabTNG$ git remote add github git@github.com:slaclab/facet-matlabTNG.git
sgess@pc95258:~/git_work/matlabTNG$ git remote -v
github	git@github.com:slaclab/facet-matlabTNG.git (fetch)
github	git@github.com:slaclab/facet-matlabTNG.git (push)
origin	ssh://sgess@centos7:/afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git (fetch)
origin	ssh://sgess@centos7:/afs/slac/g/cd/swe/git/repos/slac/FACET/matlabTNG.git (push)
sgess@pc95258:~/git_work/matlabTNG$ git pull
sgess@centos7's password: 
Already up to date.
sgess@pc95258:~/git_work/matlabTNG$ git push -u github master
Enumerating objects: 659, done.
Counting objects: 100% (659/659), done.
Delta compression using up to 12 threads
Compressing objects: 100% (272/272), done.
Writing objects: 100% (607/607), 2.14 MiB | 4.65 MiB/s, done.
Total 607 (delta 364), reused 565 (delta 326), pack-reused 0
remote: Resolving deltas: 100% (364/364), completed with 33 local objects.
To github.com:slaclab/facet-matlabTNG.git
   5ce751c..e251582  master -> master
Branch 'master' set up to track remote branch 'master' from 'github'.

Git Etiquette

Gitlist

https://lcls-dev3.slac.stanford.edu/gitlist/slac/FACET/matlabTNG.git


Try to solve Git problems: https://github.com/k88hudson/git-flight-rules