For Week2 : Web development assignment goto:
Week2 web development page
Work through Git tutorial
- Get the general idea of version control using Git
- Push your website to the personal repository on Gitlab
- Add CI file to establish the link to Fabacademy personal page
macOS Sierra
version: 10.12.1
Git gui
[Tutorial]
To activate, go to terminal
$ git gui
Sourcetree -link
Easy to track commits when you are working on many branches.
$ git pull : download the latest version from the repository
Make changes, add new file, etc.
$ git status : check which branch are you in and changes you have done.
$ git add . : stage all changes.
$ git commit -m “(commit message)” : commit change.
$ git push : upload the commits you made.
$ git log : check what you have done.
$ git pull : fetch and merge to your local repository
$ git fetch
$ git merge
$ git add
$ git commit
$ git push
$ git reset --hard HEAD : you want your working-tree go back to latest commit state.
$ git revert # --no-edit : you want to cancell some commit you have made
$ git status
$ git branch
$ git checkout
$ git log
$ git diff : see difference inside files
launch terminal
$git --version
If git is not there, download and install -link
$ git config --global user.name “John Doe”
$ git config --global user.email "John@doe.com"
$ ssh-keygen
For fabacademy use, simply keep pressing enter. Then SSH key pair will be generated in /Users/me/.ssh as “id_rsa” and “id_rsa_pub”
$ cd /users/me/.ssh
$ cat id_rsa.pub
Copy the text, go to Gitlab page and paste it to “Key” feed. Set title make you easy to recognize the key.
Go to your repository page on Gitlab and copy SSH url.
$ cd
$ mkdir fabacademy(or anything)
$ git clone (paste SSH address)
$ cd (your local repository)
$ vi index.html:add html file in your working tree. Use “.wq” command to exit from vi.
$ git status $ git add index.html :or add “.”,"-all" to stage all changes.
$ git commit -m “added index.html”(or anything)
$ git status
$ git push
$ git status
You should be seeing “Your branch is up-to-date with ‘origin/master’. nothing to commit, working tree clean” message.
Create new file in Gitlab personal repository.
Choose type of file “ .gitlab-ci.yml “.
Apply a GitLab CI Yaml template “ HTML ”
Type commit message.
Commit Change.
Your student page will be visible in mean while…
Do “git pull” before you change something on your local repository if you have changed remote repository on Gitlab.