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.
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.
The configration setting can be checked with using the command "git config --list".
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.$ git config --global user.email "taro@aa.com"
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
・・・・・
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
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
- Manager
- Database
- Storage Area
【Type of Repository】
Thre are two types of repository.
- Local Repository
- Remote repository
【bare vs none-bare】
From a different point of view, repository can be classified as follows.
From a different point of view, repository can be classified as follows.
- bare Repository
- non-bare repository
【Communicating Protocol for Remote Repository】
There are two types of protocol to communicate with the remote repository of GitLab.
- HTTPS
- SSH
(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]
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.
- Make a new repository by ourselves
- Clone(copy) a existing remote repository (1)check the repsitory URL on gitlab
$ cd ~~ //directory where we want to manage
$ git init
$ git init
(2)use "git clone" command
$ cd ~~ //directory where we want to colne the remote directry
$ git clone https://~~~/~~~/~~~ //URL of remote repository
$ git clone https://~~~/~~~/~~~ //URL of remote repository
■Version Control in the Local Repository
To understanding "git" version control, we have to understad some concept of state.
- Working state This word is for my understanding.(not an official word)
- Staged state This is the state of listing the files to save as logs(snapshot).
- Committed sate This is the saved state as logs(snapshot).
This is the state of operating files like modifing files, delete files, add files(untracked files).
$ 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 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.
$ 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 reset . //This command means to be cannceled all staged files.
$ 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
References
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.
■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.