Week2 : Project Management

git

I had heard the word "git", but I did't understand it. "git" is the version control system(VCS) in which all change history is sotred in the repository. We can use "git" as private or collaborative work.
We can check the change history and get the file of the previous version with "git". In other words, "git" is the history chronology of the project, and it's also a time machine.
Version Control System is used for collaboration, storing versions, restoring changes, finding out what changed, making backups, and publishing.

■Setup

We can get latest edition "git" from here
After install "git", some set up is needed. The first thing to do is setting user indentity(user-name and email adress) .
To set user indentiy, we use "git config" tool.
$ git config --global user.name "Taro Nihon"
$ git config --global user.email "taro@aa.com"
Editor and diff tool are can be set with "git config", but it's not necessary.
The configration setting can be checked with using the command "git config --list".
$ git config --list
・・・・・
user.name=Taro Nihon
user.email=aro@aa.com

■Repository

At first, I could not understand the difference between the directory and the repository・・・. Some website explain the repository as a strage place, but I think it is not accurate explanation.
Repository is a place where we can store the change history and the status. By placing the directory we want to manage under the control of the repository, the change history in that directory is can be recorded.
So, I understood like that a repository has
  1. Manager
  2. Database
  3. Storage Area
functions.

【Type of Repository】

Thre are two types of repository.
  1. Local Repository
  2. Remote repository
Local repository is the repository that is placed on our own PC and use for each user. Remote repository is the repository for sharing multiple people placed on the server.
【bare vs none-bare】
From a different point of view, repository can be classified as follows.
  1. bare Repository
  2. non-bare repository
Non-bare repository has the working area, bare repository doesn't have the workin area.Non-bare repository is for work and bare repository is for update. Loacal repository is none-bare repository, and bare repository is recommended for remote repositories.

【Communicating Protocol for Remote Repository】

There are two types of protocol to communicate with the remote repository of GitLab.
  1. HTTPS
  2. SSH
In the case of using HTTPS, there is no need to any additional settings. On the otherhand, in the case of using SSH, it needs some settings as fllows.
(1)Generating a SSH public key by using "ssh-keygen" command
$ ssh-keygen
If "ssh-keygen" command is executed, the following message will be displayed.There is no need to input anything in this process.
Generating public/private rsa key pair.
Enter file in whick to save the key(/Users/~/.ssh/id_rsa):[Enter]
If you need a passphrase for security, enter passphrase.If you don't need to set the passphrase, only press the Enter key. (I set my passphrase)
Enter passphrase (empty for no passphrase):[passphrase]
It need to enter the same passphrase for the confirmation.

(2)Confirm SSH-public key.
$ cat ~/.ssh/id_rsa.pub
The characters start with "ssh-rsa" is the public key. Copy public key.

(3)Paste SSH-public key to GitLab.
[Settings]-->[SSH Keys]-->Paste SSH public key-->[Add key]


【How to make a Local Repository】

There are two ways to make a local repository.
  1. Make a new repository by ourselves
  2. $ cd ~~        //directory where we want to manage
    $ git init
  3. Clone(copy) a existing remote repository
  4. (1)check the repsitory URL on gitlab
    (2)use "git clone" command
    $ cd ~~        //directory where we want to colne the remote directry
    $ git clone https://~~~/~~~/~~~        //URL of remote repository
★In the case of FabAcademy2018, student's remote repository had been already made, so we should cloned the remote repository. It isn't need to do "git init" after clone the remote repository.(This is important point! I failed with that and wasted several hours.....)

■Version Control in the Local Repository

To understanding "git" version control, we have to understad some concept of state.
  1. Working state
  2. This word is for my understanding.(not an official word)
    This is the state of operating files like modifing files, delete files, add files(untracked files).
  3. Staged state
  4. This is the state of listing the files to save as logs(snapshot).
  5. Committed sate
  6. This is the saved state as logs(snapshot).
The act of committing is to "save the snapshot after change" instead of "record the differences".
$ git status                                     //This command means to chek the working state and staged state

$ git add [filename]                         //This command means to sage a file
$ git add .                                      //This command means to sage all file and directories

$ git commit -m "message"              //This command means to commit all staged files.
                                                    //message is for help users understanding versions.

$ git log                                        //This command means to check the commit logs.
If we want to go back to past at the local repository, "git checkout" and "git reset" is available. If we want to cancel the staged files, it can be reset as follows.
$ git reset [filename]
$ git reset .                                  //This command means to be cannceled all staged files.
If we want to go back to the the specific commited sate at the local repository, it can be gone back as follows.(commited hash-value can be checked with "git log")
$ git checkout [commited hash-value]

■Working with Remote Repository

After commit the files, we can push it to remote repository.
$ git push
To get data from remote repository, "git pull" is used.(pull command include fetch and merge functions)
$ git pull

Build Personal Site

■Editor

I tried three editors, vi, atom and blackets. vi is not a powerfull edior, atom and blackets is powerful edior.Blackets was the easy to use for me, because of its "live-preview" function.
vi
Atom
Blackets

■CSS(Cascading Style Sheets)

In order to make it easy to create html files. I use css file.I created the css file referring to the example in this book.