Updated at Tue Oct 18 22:51:40 CST 2022 by update-readme-post.sh
How to Work with Us
Ruby & Jekyll
We recommend Ruby 2.7.2, if you use other version of Ruby, you need to handle all red alerts by yourself xd. And don’t apply the modification of Gemfile.lock
to git, this may make others can’t use their environment.
Clone This Repo
1git clone git@github.com:lab530/lab530.github.io.git
I will use (branch)
notation to mark current branch.
DO NOT operate main
branch directly. Please use your own branch and use merge
to merge commits to main
branch.
Git Basics
Check local branches / current branch
1git branch
Switch to an existed branch(e.g.: main
)
1git checkout main
Create a new branch(e.g.: ly-dev
)
1git checkout -b ly-dev
Delete an existed branch
1git branch -d ly-dev
Push & set upstream, use -u
or --set-upstream
1(main) git push -u origin main
Merge branch(e.g.: merge ly-dev
into main
)
1(main) git merge ly-dev
How to Modify This Repo
0. Create your own dev branch
1(main) git checkout -b yescafe-dev
2(yescafe-dev) git branch # check current branch
1. Sync main
branch
This is NECESSARY! DO NOT forget!
1git checkout main
2(main) git pull origin main
If there are some new commits, merge back to your dev branch.
1(main) git checkout yescafe-dev
2(yescafe-dev) git merge main
2. Work on your dev branch
1git checkout yescafe-dev
And then edit your codes and posts!
3. Make a commit
After you finish your work, add all modified files to cache and commit a message.
1(yescafe-dev) git add -A
2(yescafe-dev) git commit -m "A commit message here"
This is a basic operation, and this is not the only way. Learn and try it by yourself.
4. Deploy & check your modifications
Use Ruby and Jekyll to deploy the website on your local machine, I recommend RVM. If you use Lazarus’s server, you don’t need to setup Ruby and Jekyll environment by yourself, just execute it.
1jekyll s --host 0.0.0.0
Then access 127.0.0.1:4000
on your browser, and check your modifications.
If you are using the Lazarus’s server and not sure of whether you are the only one using jekyll at the meantime, you should use a different specified port instead of the default one(4000), such as 4001, 4002, for example:
1jekyll s --host 0.0.0.0 --port 4001
And access 127.0.0.1:4001
.
Tips: --host 0.0.0.0
is not necessary, this can help you access this local website via your LAN IP address using another device.
5. Merge to main
If you think there is no error, switch to main
branch, sync with the upstream again, then merge commits.
This is also NECESSARY!
1(yescafe-dev) git checkout main
2(main) git pull origin main
3(main) git merge yescafe-dev
If you don’t do pull firstly and merge directly like me, while you are pushing, git may tell you:
If you don’t have powerful git skills like me, do not try this.
6. Handle with conflicts
Reserved.
Oh, this would be a technique which you should have learned.
7. Push to upstream
At the first time, execute:
1(main) git push -u origin main
to push and set upstream.
And in the next time, you could just run:
1(main) git push