| 1 | = Version Control with ''git'' = |
| 2 | |
| 3 | Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. |
| 4 | |
| 5 | To use git on Cypress, you have to load module. It is better to set this in ''.modulerc'' |
| 6 | {{{#!bash |
| 7 | [fuji@cypress2 workshop]$ module load git |
| 8 | }}} |
| 9 | |
| 10 | == Create a project repository == |
| 11 | On your project directory, for example, (replace dpg with your project folder name) |
| 12 | {{{#!bash |
| 13 | [fuji@cypress2 ~]$ cd /lustre/project/dpg |
| 14 | [fuji@cypress2 dpg]$ mkdir repos |
| 15 | [fuji@cypress2 dpg]$ cd repos |
| 16 | [fuji@cypress2 repos]$ mkdir git |
| 17 | [fuji@cypress2 repos]$ cd git |
| 18 | [fuji@cypress2 git]$ mkdir projectX |
| 19 | [fuji@cypress2 git]$ cd projectX |
| 20 | [fuji@cypress2 projectX]$ git init |
| 21 | Initialized empty Git repository in /lustre/project/dpg/repos/git/projectX/.git/ |
| 22 | }}} |
| 23 | |
| 24 | Add a file and commit |
| 25 | {{{#!bash |
| 26 | [fuji@cypress2 projectX]$ echo "This is README.txt for my git-repo" > README.txt |
| 27 | [fuji@cypress2 projectX]$ git add README.txt |
| 28 | [fuji@cypress2 projectX]$ git commit -m"first commit" |
| 29 | [master (root-commit) 4fe9eae] first commit |
| 30 | Committer: Hideki Fujioka <fuji@cypress2.cm.cluster> |
| 31 | Your name and email address were configured automatically based |
| 32 | on your username and hostname. Please check that they are accurate. |
| 33 | You can suppress this message by setting them explicitly. Run the |
| 34 | following command and follow the instructions in your editor to edit |
| 35 | your configuration file: |
| 36 | |
| 37 | git config --global --edit |
| 38 | |
| 39 | After doing this, you may fix the identity used for this commit with: |
| 40 | |
| 41 | git commit --amend --reset-author |
| 42 | |
| 43 | 1 file changed, 1 insertion(+) |
| 44 | create mode 100644 README.txt |
| 45 | }}} |
| 46 | |
| 47 | Make a clone repository on Cypress, |
| 48 | {{{#!bash |
| 49 | [fuji@cypress2 ~]$ git clone file:///lustre/project/dpg/repos/git/projectX |
| 50 | Cloning into 'projectX'... |
| 51 | remote: Counting objects: 3, done. |
| 52 | remote: Total 3 (delta 0), reused 0 (delta 0) |
| 53 | Receiving objects: 100% (3/3), done. |
| 54 | Checking connectivity... done. |
| 55 | [fuji@cypress2 ~]$ ls |
| 56 | projectX |
| 57 | }}} |
| 58 | |
| 59 | Make a clone repository over network, (you may have to type password) |
| 60 | {{{#!bash |
| 61 | Hideki02:~ fuji$ git clone fuji@cypress1.tulane.edu:/lustre/project/dpg/repos/git/projectX |
| 62 | Cloning into 'projectX'... |
| 63 | remote: Counting objects: 3, done. |
| 64 | remote: Total 3 (delta 0), reused 0 (delta 0) |
| 65 | Receiving objects: 100% (3/3), done. |
| 66 | Checking connectivity... done. |
| 67 | Hideki02:~ fuji$ ls |
| 68 | projectX |
| 69 | }}} |
| 70 | Since git is not a default module on Cypress, you have to set '''~/.modulerc''' like: |
| 71 | {{{#!bash |
| 72 | #%Module3.2.10 |
| 73 | module load git |
| 74 | }}} |