Difference between revisions of "Guide to Using Git"

From GlueXWiki
Jump to: navigation, search
(Add new files to git)
(Creating a local clone of the repository)
Line 1: Line 1:
 
== Creating a local clone of the repository ==
 
== Creating a local clone of the repository ==
The first thing you need to do is to create a clone of the master repository on your local machine.  The "git clone" command pulls all of the code, branches, etc. for the entire history of the project into the current, local directory.   
+
The first thing you need to do is to create a clone of the master repository on your local machine.  The <span style="color:#0000FF">"git clone"</span> command pulls all of the code, branches, etc. for the entire history of the project into the current, local directory.   
 
* In general, you might want to have several separate branches of the repository built simultaneously on your machine.  For example, you may want to have a program running off of "VersionA" and meanwhile develop code separately on "VersionB." To do this, you need multiple clones of the repository.  
 
* In general, you might want to have several separate branches of the repository built simultaneously on your machine.  For example, you may want to have a program running off of "VersionA" and meanwhile develop code separately on "VersionB." To do this, you need multiple clones of the repository.  
  

Revision as of 20:12, 29 July 2015

Creating a local clone of the repository

The first thing you need to do is to create a clone of the master repository on your local machine. The "git clone" command pulls all of the code, branches, etc. for the entire history of the project into the current, local directory.

  • In general, you might want to have several separate branches of the repository built simultaneously on your machine. For example, you may want to have a program running off of "VersionA" and meanwhile develop code separately on "VersionB." To do this, you need multiple clones of the repository.

Examples

To create a clone of the master repository into the directory <mydir>:

References

Add new files to git

If you create new files or directories, they are initially "untracked;" you need to add them to git to track them. Note that the below example code does not commit a change, it just tells git to track the file.

Example

To add a file to git:

  • git add <myfile>

References

Create a local branch

    • cd sim-recon
    • git branch my_work
  1. Check-out the new branch
    • git checkout my_work