HOME

Weikai Mao

Weikai Mao

maoweikai123@outlook.com

Categories:

© 2024

Small Code Memo


Git

Initialize a new local repository:

$ git init

Stage all local changes in <directory> for the next commit: (Replace <directory> with a <file> to stage the changes of a specific file. Replace with -A to stage all changes.). The <directory> will be tracked.

$ git add <directory>

List which files are staged, unstaged, and untracked:

$ git status

Unstage everything (retain changes):

$ git reset

Commit all local changes (include unstaged changes) in tracked files:

$ git commit -a -m "<message>"

Commit previously staged changes with message:

$ git commit -m "<message>"

Connect the local repository to the GitHub (remote) repository:

$ git remote add origin <GitHubRepoURL>

Verify the connection:

$ git remote -v

Push to GitHub (remote) repository:

$ git push

Fetches all files from GitHub (remote) repository (remember to backup local repository before execute this command):

$ git pull --all

SQL

The input of the function MAX() must be a group of data.

SELECT id, name FROM table where id = MAX(id); # invalid
SELECT id, name FROM table where id = (SELECT MAX(id) FROM table); # valid

Jekyll

Make the local Jekyll server work:

$ bundle exec jekyll serve --watch

Ubuntu

Run the command below before using a *.AppImage program.

$ chmod a+x *.AppImage


Comments