Git: Working with Remotes from the Command Line

(Difference between revisions)
Jump to: navigation, search
(Blanked the page)
Line 1: Line 1:
 +
__NOTOC__
 +
{| border="1"
 +
|-
 +
|'''Title''' ||Cloning a Module Using Git
 +
|-   
 +
|'''Overview''' ||
 +
Open source community comes with many different applications and modules which are constantly under development. In order to become familiar with a particular module, you need to clone the module on your virtual machine. Almost all the open source modules developed by the community use version control systems to manage and organize the changes. This document provides steps to clone a module from one such version control system.
  
 +
Version Control:
 +
A version control system is a repository of files that records the changes to a file or set of files often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change so that you can recall specific versions later.
 +
In this lab we will be using a git version control system.
 +
 +
Git version control:
 +
git is an open source distributed version control system originally developed by Linus Torvalds to support the development of the Linux kernel. Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server.
 +
Git can be used as a local version control system without having any central repository.
 +
 +
 +
 +
|-
 +
|'''Prerequisite Knowledge''' ||Familiarity with Git Server
 +
 +
 +
|-
 +
|'''Learning Objectives''' ||Cloning using Git;   
 +
|}
 +
 +
=== Background: ===
 +
The installed version of Fedora Operating system has git version control system preinstalled. If not, please refer to the document Lab - Setting up git.docx and install it before proceeding further.
 +
To check if git was installed and working correctly, open VirtualBox and start Fedora 22 Operating System.
 +
After logging in to the Virtual Machine using the user credentials created during installation, open terminal program as shown below.
 +
 +
1. Click on “Activities” on the top left and type “Terminal” in the search bar.
 +
 +
2. Now click on the Terminal Button displayed in the search results and type the command “git” in the command line.
 +
Please refer to https://git-scm.com/docs for getting familiar with all the git commands available.
 +
=== Directions: ===
 +
'''Cloning a module using git:''' Cloning a module of a git repository is done using any of the three protocols (git, https, or ssh). There is no need to worry about the protocol and git automatically takes care of it. Just follow the steps below:
 +
 +
In this lab, we will be cloning gnome-photos module as an example into the local workstation. All the changes we make to the source are maintained independent from the master copy using branches without messing up with the original source.
 +
 +
gnome-photos clone links:
 +
• git://git.gnome.org/gnome-photos
 +
 +
• https://git.gnome.org/browse/gnome-photos
 +
 +
• ssh://USERNAME@git.gnome.org/git/gnome-photos
 +
 +
Any of the above three URI’s can be used in the cloning process.
 +
 +
1. To clone a module from git central repository, we use the command “git clone”.
 +
 +
$ git clone [git/ssh/https URI]
 +
 +
Note: git clone command clones the repository to the present working directory in the terminal.
 +
 +
2. Once done, the source code of the cloned module can be viewed in the file system.
 +
 +
 +
Now that we had a copy of original source in our local workstation. Before making any changes to the source, it is a good idea to create a separate branch with the change_id so that we would not mess up with the master copy.
 +
 +
'''Creating a new branch with change_id:'''
 +
 +
Now let’s create a new branch with CH_0001 as its name. $ git branch lists all the branches available. And to switch between different branches, we use the command $ git checkout [branch-name].
 +
 +
3.    List all the branches currently available using the following command:
 +
 +
$ git branch
 +
 +
At the moment, we have only one branch i.e., master branch.
 +
 +
4.    Create a new branch using the command:
 +
 +
$ git branch CH_0001
 +
 +
This creates a new branch with name CH_0001, but we are still working on default (master) branch.
 +
 +
5.  Check out CH_0001
 +
 +
To make any changes to the new branch created, we need to open that branch for editing. This can be done using the command:
 +
 +
$ git checkout CH_0001
 +
 +
The code is available to you to be changed.
 +
 +
 +
 +
]
 +
 +
'''Documentation:'''
 +
 +
Create a file in your favorite editor. Add all your screenshots and then answer the following questions in the next section in your file.
 +
Also, review the following rubric for generating and submitting your work.  Once you are satisfied that your lab is complete, create a pdf file and name it FossCloneWithGitLab_yourlastnamefirstinitial.pdf. Upload to your course management system.
 +
 +
=== Deliverables: ===
 +
Create a word document and include screenshots of different stages of installations in it. In addition, answer the questions.
 +
 +
 +
'''Cloning Lab Rubric (100 points)'''
 +
 +
Screenshots of the above 5 steps (50 points)
 +
 +
Lab Questions (50 points)    • What is Git Server? (10 points)      • Name several free git servers for educational purposes. (10 points)      • Explain the importance of version control. (10 points)            •    What would  the branch and checout commands do ? (10 points) • Grammar, Spelling and Neatness (5 points) – named file correctly and uploaded properly on time. (5 points)
 +
 +
 +
=== Comments: ===
 +
 +
=== Additional Information: ===
 +
{| border="1"
 +
|-
 +
|'''Knowledge Area/Knowledge Unit''' ||  Cloning
 +
|-
 +
|'''Topic''' || 
 +
|-
 +
|'''Level of Difficulty''' ||
 +
|-
 +
|'''Estimated Time to Completion''' ||2 hours
 +
|-
 +
|'''Materials/Environment''' ||
 +
|-
 +
|'''Author''' ||  Mohsen Dorodchi
 +
|-
 +
|'''Source''' ||
 +
|-
 +
|'''License''' ||
 +
|}
 +
 +
 +
--------------------
 +
 +
 +
[[Category: Learning_Activity]]
 +
[[Category: Subcategory:Install Fedora 22 In VirtualBox]]

Revision as of 02:14, 30 September 2015

Title Cloning a Module Using Git
Overview

Open source community comes with many different applications and modules which are constantly under development. In order to become familiar with a particular module, you need to clone the module on your virtual machine. Almost all the open source modules developed by the community use version control systems to manage and organize the changes. This document provides steps to clone a module from one such version control system.

Version Control: A version control system is a repository of files that records the changes to a file or set of files often the files for the source code of computer programs, with monitored access. Every change made to the source is tracked, along with who made the change, why they made it, and references to problems fixed, or enhancements introduced, by the change so that you can recall specific versions later. In this lab we will be using a git version control system.

Git version control: git is an open source distributed version control system originally developed by Linus Torvalds to support the development of the Linux kernel. Every Git working directory is a full-fledged repository with complete history and full version tracking capabilities, not dependent on network access or a central server. Git can be used as a local version control system without having any central repository.


Prerequisite Knowledge Familiarity with Git Server


Learning Objectives Cloning using Git;

Background:

The installed version of Fedora Operating system has git version control system preinstalled. If not, please refer to the document Lab - Setting up git.docx and install it before proceeding further. To check if git was installed and working correctly, open VirtualBox and start Fedora 22 Operating System. After logging in to the Virtual Machine using the user credentials created during installation, open terminal program as shown below.

1. Click on “Activities” on the top left and type “Terminal” in the search bar.

2. Now click on the Terminal Button displayed in the search results and type the command “git” in the command line. Please refer to https://git-scm.com/docs for getting familiar with all the git commands available.

Directions:

Cloning a module using git: Cloning a module of a git repository is done using any of the three protocols (git, https, or ssh). There is no need to worry about the protocol and git automatically takes care of it. Just follow the steps below:

In this lab, we will be cloning gnome-photos module as an example into the local workstation. All the changes we make to the source are maintained independent from the master copy using branches without messing up with the original source.

gnome-photos clone links: • git://git.gnome.org/gnome-photos

https://git.gnome.org/browse/gnome-photos

• ssh://USERNAME@git.gnome.org/git/gnome-photos

Any of the above three URI’s can be used in the cloning process.

1. To clone a module from git central repository, we use the command “git clone”.

$ git clone [git/ssh/https URI]

Note: git clone command clones the repository to the present working directory in the terminal.

2. Once done, the source code of the cloned module can be viewed in the file system.


Now that we had a copy of original source in our local workstation. Before making any changes to the source, it is a good idea to create a separate branch with the change_id so that we would not mess up with the master copy.

Creating a new branch with change_id:

Now let’s create a new branch with CH_0001 as its name. $ git branch lists all the branches available. And to switch between different branches, we use the command $ git checkout [branch-name].

3. List all the branches currently available using the following command:

$ git branch

At the moment, we have only one branch i.e., master branch.

4. Create a new branch using the command:

$ git branch CH_0001

This creates a new branch with name CH_0001, but we are still working on default (master) branch.

5. Check out CH_0001

To make any changes to the new branch created, we need to open that branch for editing. This can be done using the command:

$ git checkout CH_0001

The code is available to you to be changed.


]

Documentation:

Create a file in your favorite editor. Add all your screenshots and then answer the following questions in the next section in your file. Also, review the following rubric for generating and submitting your work. Once you are satisfied that your lab is complete, create a pdf file and name it FossCloneWithGitLab_yourlastnamefirstinitial.pdf. Upload to your course management system.

Deliverables:

Create a word document and include screenshots of different stages of installations in it. In addition, answer the questions.


Cloning Lab Rubric (100 points)

Screenshots of the above 5 steps (50 points)

Lab Questions (50 points) • What is Git Server? (10 points) • Name several free git servers for educational purposes. (10 points) • Explain the importance of version control. (10 points) • What would the branch and checout commands do ? (10 points) • Grammar, Spelling and Neatness (5 points) – named file correctly and uploaded properly on time. (5 points)


Comments:

Additional Information:

Knowledge Area/Knowledge Unit Cloning
Topic
Level of Difficulty
Estimated Time to Completion 2 hours
Materials/Environment
Author Mohsen Dorodchi
Source
License



Personal tools
Namespaces
Variants
Actions
Events
Learning Resources
HFOSS Projects
Evaluation
Navigation
Toolbox