John Blischak Update box numbering.  over 8 years ago

Commit id: 1eaa99df26dfefa1074d4dcb670436ead0e81a2e

deletions | additions      

       

\item \textbf{commit}: \textit{(noun)} a snapshot of changes made to the staged file(s); \textit{(verb)} to save a snapshot of changes made to the staged file(s)   \item \textbf{stage}: \textit{(noun)} the staging area holds the files to be included in the next commit; \textit{(verb)} to mark a file to be included in the next commit  \item \textbf{track}: \textit{(noun)} a tracked file is one that is recognized by the Git repository  \item \textbf{branch}: \textit{(noun)} a parallel version of the files in a repository (Box 2) 5)  \item \textbf{local}: \textit{(noun)} the version of your repository that is stored on your personal computer  \item \textbf{remote}: \textit{(noun)} the version of your repository that is stored on a remote server, for instance on GitHub  \item \textbf{clone}: \textit{(verb)} to create a local copy of a remote repository on your personal computer               

\subsection{Box 4: 2:  Choosing a license} Putting software and other material in a public place is not the same  as making it publicly usable. In order to do that, the authors must               

\subsection{Box 5: 4:  Managing large files} Many biological applications require handling large data files.  While Git is best-suited for collaboratively writing small text files, nonetheless collaboratively working on projects in the biological sciences necesitates managing this data.               

\subsection{Box 2: 5:  Branching} Do you ever make changes to your code, but are not sure you will want to keep those changes for your final analysis? Using Git, you can maintain parallel versions of your code that you can easily bounce between while you are working on your changes. You can think of it like making a copy of the folder you keep your scripts in, so that you have your original scripts intact but also have the new folder where you make changes. Using Git, this is called branching and it is better than separate folders because 1) it uses a fraction of the space on your computer, 2) keeps a record of when you made the parallel copy (branch) and what you have done on the branch, and 3) there is a way to incorporate those changes back into your main code if you decide to keep your changes (and a way to deal with conflicts). By default, your repository will start with one branch, usually called ``master''. To create a new branch in your repository, type \verb|git branch new_branch_name|. You can see what branches a current repository has by typing \verb|git branch|, with the branch you are currently in being marked by a star. To move between branches, type \verb|git checkout branch_to_move_to|. You can edit files and commit them on each branch separately. If you want combine the changes in your new branch with the master branch, you can merge the branches by typing \verb|git merge new_branch_name| while in the master branch.        

You can have others contribute to your projects using the same workflow.  The ability to use Git to contribute changes is very powerful because it allows you to improve the software that is used by many other scientists and also potentially shape the future direction of its development.           

methods.tex  box-1-definitions.tex  table-1-resources.tex  box-2-branching.tex box-2-licensing.tex  box-3-what-not-to-version-control.tex  box-4-licensing.tex  box-5-managing-large-files.tex box-4-managing-large-files.tex  box-5-branching.tex  figures/figure-legends.tex  figures/Fig1/Fig1.png  figures/Fig2/Fig2.png         

\subsection{Share your code}  Once you have your files saved in a Git repository, you can share it with your collaborators and the wider scientific community by putting your code online (see Box 4 2  for advice on licensing your code). This also has the added benefit of creating a backup of your scripts and provides a mechanism for transferring your files across multiple computers.  Sharing a repository is made easier if you use one of the many online services that host Git repositories (Table 1), e.g. GitHub.  Note, however, that any files that have not been tracked with at least one commit are not included in the Git repository, even if they are located within the same directory on your local computer (see Box 3 for advice on the types of files that should not be versioned with Git and Box 5 4  for advice on managing large files). To begin using GitHub, you will first need to sign up for an account.  For the code examples in this tutorial, you will need to replace \verb|username| with the username of your account. 

\end{verbatim}  You first specify the remote repository, ``origin''.  Second, you tell Git to push to the ``master'' copy of the repository - we will not go into other options in this tutorial, but Box 2 5  discusses them briefly. Pushing to GitHub also has the added benefit of backing up your code in case anything were to happen to your computer.  Also, it can be used to manually transfer your code across multiple machines, similar to a service like Dropbox, but with the added capabilities and control of Git. 

However, with projects with lots of contributors, GitHub provides a workflow for finer-grained control of the code development.  With the addition of a GitHub account and a few commands for sending and receiving code, you can now share your code with others, transfer your code across multiple machines, and setup simple collaborative workflows.