資訊之芽 2022 Python 語法班
Author: Sean 韋詠祥
Note:
日期:2022-05-08
先開啟 iTerm2 或 Terminal 終端機
輸入 git 指令,內建的 Xcode 將會跳出安裝資訊
git --version
搜尋 Git for Windows
基本上都下一步,編輯器這邊可以改成自己慣用的
相信你知道怎麼做的 :D
# Debian / Ubuntu
apt install git
# Fedora
dnf install git
# Arch Linux
pacman -S git
# Alpine
apk add git
驗證碼:選出螺旋星系
可點擊下方 Skip 跳過
先大概理解就好,也可以上網查「Bash XXX 用法」
ls # 列出目前目錄下的檔案
ls -a # 包含隱藏檔案
ls -l # 顯示詳細資訊
ls -al # 我全都要!
touch myfile # 建立空檔案
mkdir mycode # 建立資料夾
mv myfile file1 # 移動檔案
cp file1 file2 # 複製檔案
pwd # 顯示當前目錄
cd mycode # 進入資料夾
cd .. # 回到前一層目錄
cd # 不加參數,代表回到家目錄
echo Hey
echo "Hello World"
cat /etc/passwd # 印出檔案內容
less /etc/passwd # 慢慢查看檔案內容
rm file1 # 刪除檔案
rmdir mycode # 刪除空資料夾
資訊之芽 2022 Python 語法班
Author: Sean 韋詠祥
git config --global user.name "Sean" # 你的暱稱
git config --global user.email me@sean.taipei
git config --global color.ui true
git config --global init.defaultBranch master
git config --global alias.lg "log --color --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
git config --global core.editor vim
git config --global merge.tool vimdiff
git config --global core.excludesFile = ~/.gitignore
git config --global gc.auto 0
git config --global pull.ff only
git config --global rerere.enable true
git config --global rebase.autosquash true
git config --global checkout.defaultRemote origin
git config --global url."git@github.com:".insteadOf "https://github.com/"
Git Repository
# 建立資料夾並初始化 git
mkdir py-project
cd py-project
git init
# 建立 main.py 檔案
vim main.py
git add main.py
git commit
# 在編輯器中輸入 commit 訊息
# 完成!
先用編輯器打開 main.py
檔案
讓他輸出 0 到 4 這五個數字,每次換行
完成後用 git 保存版本紀錄
git status
git add main.py
git commit
輸入:一個正整數 N
輸出:從 0 到 N-1 的數字,每次換行
git diff
git add -p main.py
git commit
輸入:一個正整數 N
輸出:從 1 到 N 的數字,每次換行
git add -p .
git commit -m '###'
git show
git show HEAD~1
git remote add origin https://github.com/#####/######.git
git remote -v
git push -u origin master
touch README.md # 去編輯 README.md 檔案
git add README.md
git commit
git push
git fetch --all
git pull
git log
讓我們進到 Git 進階用法
小練習:
輸入前詢問「Input N: 」
輸出 0 到 N-1
git switch
git switch -c feat-prompt-input
git reset
git status
git restore
git clean -x -i -d
git stash
git stash pop
git rebase -i master
投影片連結:https://hackmd.io/@Sean64/git-sprout2022
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing