Changes between Version 4 and Version 5 of Chimera2/git


Ignore:
Timestamp:
May 6, 2013, 10:24:33 AM (13 years ago)
Author:
Conrad Huang
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Chimera2/git

    v4 v5  
    5454{{{#!html
    5555<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
    56 <b style="color:#c22;">[loft - /e]$ git clone \
     56<b style="color:#2a2;">[loft - /e]$ git clone \
    5757  ssh://conrad@plato.cgl.ucsf.edu/usr/local/projects/chimera2/git/chimera2.git \
    5858  chimera2</b>
     
    6363Receiving objects: 100% (556/556), 311.17 MiB | 621 KiB/s, done.
    6464Resolving deltas: 100% (170/170), done.
    65 <b style="color:#c22;">[loft - /e]$ cd chimera2</b>
     65<b style="color:#2a2;">[loft - /e]$ cd chimera2</b>
    6666/e/chimera2
    67 <b style="color:#c22;">[loft - /e/chimera2]$ git flow init -d</b>
     67<b style="color:#2a2;">[loft - /e/chimera2]$ git flow init -d</b>
    6868Using default branch names.
    6969
     
    7979Support branches? [support/]
    8080Version tag prefix? []
    81 <b style="color:#c22;">[loft - /e/chimera2]$ ls -l</b>
     81<b style="color:#2a2;">[loft - /e/chimera2]$ ls -l</b>
    8282total 26
    8383-rw-r--r--+ 1 conrad None  657 May  3 10:51 Makefile
     
    9292</pre>
    9393}}}
     94
    9495== Use ''develop'' Branch Directly for Development ==
     96
     97For short tasks that one expects to complete before moving on to others, a developer may use the '''develop''' branch (in his own repository) directly, rather than creating a feature branch (see next section).  The example below shows a file being added to the repositories.  Note that modifying a file uses exactly the same steps '''git'''-wise.
     98
     99A few items of note:
     100- the '''add''' command ''__stage__s'' a file, which means that the repository version of the file will be updated ''__with the current contents of the working file__'' at the next '''commit'''.
     101- '''git diff''' may be used to compare the working file with either the staged (using no extra arguments) or the committed (using the '''HEAD''' argument) file.
     102- files may be reverted to the staged version by using the '''checkout''' command.
     103- to unstage a file and return to the committed file, use the '''reset''' command.
     104- a '''pull''' is usually done before a '''commit''' so that changes committed by others may be incorporated immediately rather than as part of a ''merge commit''.
     105- the '''-a''' flag to '''commit''' is used to stage the latest version of changes before committing.  This is different from '''svn''' where '''commit'''ting a file always commits the latest version.  In '''git''', a '''commit''' commits the version of the file ''__at the time that it was staged__''; subsequent changes will not be committed unless the file is explicitly staged again using the '''add''' command or the '''-a''' flag is specified for the '''commit''' command.
     106- the '''-m''' flag to commit specifies a log message for the commit.  To use longer log messages, omit the '''-m''' flag and a text editor (from environment variable '''EDITOR''') will automatically start.
     107- the '''commit''' command only updates the local repository.  To make changes visible to other developers, do not forget to '''push''' as well.
     108
     109{{{#!html
     110<pre style="margin-left:20px; margin-right:20px; border:solid 1px; padding:3px; background:white;">
     111<b style="color:#c22;">franklin:myrepo conrad$ pwd</b>
     112/usr/local/projects/chimera2/git/myrepo
     113<b style="color:#c22;">franklin:myrepo conrad$ git status</b>
     114# On branch develop
     115nothing to commit (working directory clean)
     116<b style="color:#c22;">franklin:myrepo conrad$ echo "hello world" > example</b>
     117<b style="color:#c22;">franklin:myrepo conrad$ git status</b>
     118# On branch develop
     119# Untracked files:
     120#   (use "git add &lt;file&gt;..." to include in what will be committed)
     121#
     122#       example
     123nothing added to commit but untracked files present (use "git add" to track)
     124<b style="color:#c22;">franklin:myrepo conrad$ git add example</b>
     125<b style="color:#c22;">franklin:myrepo conrad$ git status</b>
     126# On branch develop
     127# Changes to be committed:
     128#   (use "git reset HEAD &lt;file&gt;..." to unstage)
     129#
     130#       new file:   example
     131#
     132<b style="color:#c22;">franklin:myrepo conrad$ git diff</b>
     133<b style="color:#c22;">franklin:myrepo conrad$ echo "hello conrad" > example</b>
     134<b style="color:#c22;">franklin:myrepo conrad$ git diff</b>
     135diff --git a/example b/example
     136index 3b18e51..d21055a 100644
     137--- a/example
     138+++ b/example
     139@@ -1 +1 @@
     140-hello world
     141+hello conrad
     142<b style="color:#c22;">franklin:myrepo conrad$ git checkout example</b>
     143<b style="color:#c22;">franklin:myrepo conrad$ cat example</b>
     144hello world
     145<b style="color:#c22;">franklin:myrepo conrad$ git diff HEAD</b>
     146diff --git a/example b/example
     147new file mode 100644
     148index 0000000..3b18e51
     149--- /dev/null
     150+++ b/example
     151@@ -0,0 +1 @@
     152+hello world
     153<b style="color:#c22;">franklin:myrepo conrad$ echo "hello chimera2" > example</b>
     154<b style="color:#c22;">franklin:myrepo conrad$ git diff</b>
     155diff --git a/example b/example
     156index 3b18e51..addaf36 100644
     157--- a/example
     158+++ b/example
     159@@ -1 +1 @@
     160-hello world
     161+hello chimera2
     162<b style="color:#c22;">franklin:myrepo conrad$ git pull</b>
     163Already up-to-date.
     164<b style="color:#c22;">franklin:myrepo conrad$ git commit -a -m "example"</b>
     165[develop a3108a9] example
     166 1 files changed, 1 insertions(+), 0 deletions(-)
     167 create mode 100644 example
     168<b style="color:#c22;">franklin:myrepo conrad$ git push</b>
     169Counting objects: 4, done.
     170Delta compression using up to 64 threads.
     171Compressing objects: 100% (2/2), done.
     172Writing objects: 100% (3/3), 278 bytes, done.
     173Total 3 (delta 1), reused 0 (delta 0)
     174Unpacking objects: 100% (3/3), done.
     175To /usr/local/projects/chimera2/git/chimera2.git
     176   1d973d7..a3108a9  develop -> develop
     177</pre>
     178}}}
     179
    95180== Use Feature Branch for Development ==
     181
    96182== Stash Modified Files before Switching Branches ==
     183
    97184== Use plato Repository to Coordinate Development on Multiple Hosts ==
    98185