Changes between Initial Version and Version 1 of Workshops/IntroToHpc2015/git

Oct 19, 2015 4:30:44 PM (6 years ago)


  • Workshops/IntroToHpc2015/git

    v1 v1  
     2= Version Control with ''git'' =
     4Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
     6To use git on Cypress, you have to load module. It is better to set this in ''.modulerc'' (see below).
     8[fuji@cypress2 ~]$ module load git
     13== Create a project repository ==
     14On your project directory, for example, (replace dpg with your project folder name)
     16[fuji@cypress2 fuji]$ cd projectX
     17[fuji@cypress2 projectX]$ git init
     18Initialized empty Git repository in /lustre/project/dpg/fuji/projectX/.git/
     21Add a file and commit
     23[fuji@cypress2 projectX]$ echo "This is README.txt for my git-repo" > README.txt
     24[fuji@cypress2 projectX]$ git add README.txt
     25[fuji@cypress2 projectX]$ git commit -m"first commit"
     26[master (root-commit) 4fe9eae] first commit
     27 Committer: Hideki Fujioka <>
     28Your name and email address were configured automatically based
     29on your username and hostname. Please check that they are accurate.
     30You can suppress this message by setting them explicitly. Run the
     31following command and follow the instructions in your editor to edit
     32your configuration file:
     34    git config --global --edit
     36After doing this, you may fix the identity used for this commit with:
     38    git commit --amend --reset-author
     40 1 file changed, 1 insertion(+)
     41 create mode 100644 README.txt
     44You can work with this repository on Cypress.
     46=== Create a Bare Repository ===
     47If you want to make a git server repository, you have to make a Bare Repository. For example,
     50[fuji@cypress2 dpg]$ mkdir repos
     51[fuji@cypress2 dpg]$ cd repos
     52[fuji@cypress2 repos]$ git clone --bare ../fuji/projectX ./projectX.git
     55Add group write permissions to a repository so that people in your group can pull/push.
     56 {{{#!bash
     57[fuji@cypress2 repos]$ chgrp -R dpg projectX.git
     58[fuji@cypress2 repos]$ chmod -R g+swX projectX.git
     59[fuji@cypress2 repos]$ cd projectX.git
     60[fuji@cypress2 projectX.git]$ git init --bare --shared
     61Reinitialized existing shared Git repository in /lustre/project/dpg/repos/projectX.git/
     64=== Make a Clone Repository ===
     65Make a clone repository on Cypress,
     67[fuji@cypress2 ~]$ git clone file:///lustre/project/dpg/repos/git/projectX.git
     68Cloning into 'projectX'...
     69remote: Counting objects: 3, done.
     70remote: Total 3 (delta 0), reused 0 (delta 0)
     71Receiving objects: 100% (3/3), done.
     72Checking connectivity... done.
     73[fuji@cypress2 ~]$ ls
     77Make a clone repository over network, (you may have to type password)
     79Hideki02:~ fuji$ git clone
     80Cloning into 'projectX'...
     81remote: Counting objects: 3, done.
     82remote: Total 3 (delta 0), reused 0 (delta 0)
     83Receiving objects: 100% (3/3), done.
     84Checking connectivity... done.
     85Hideki02:~ fuji$ ls
     88Since git is not a default module on Cypress, you have to set '''~/.modulerc''' like:
     91module load git
     95== Free Git Repository ==
     96* []
     97* []
     100== Basic Commands ==
     102=== Add new files ===
     104Hideki02:projectX fuji$ git add test.txt
     106This command updates the index using the current content found in the working tree, to prepare the content staged for the next commit.
     108=== Commit ===
     110Hideki02:projectX fuji$ git commit -m"message"
     112Stores the current contents of the index in a new commit along with a log message from the user describing the changes. At this point, only your local clone has your modification.
     114=== push ===
     115When you have your project at a point that you want to share with your group people, you have to push it to a master repository.
     117Hideki02:projectX fuji$ git push
     119You may have to type password for Cypress.
     121=== pull ===
     122To pull current project in the master repository,
     124Hideki02:projectX fuji$ git pull
     127== Documents ==
     128* []