Git SOP on OpenDB
基本指令
創建 .git 目錄
Add
-
新增 file1.txt & file2.txt
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
-
用 git status
查看目前 git 狀態
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
表示 file1.txt 與 file2.txt 尚未加入版本控制
git add [filename/directory]
: 加入至暫存區
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
表示已加入,移除使用 git rm --cached [filename]
commit
git commit -m "描述"
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
查詢版本
- 列出版本的詳細資料:
git log
- 列出所有的版本變化:
git reflog
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
恢復版本
所做修改 (edit file2),且加入版本控制
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
確認恢復上一個狀態 –– reset
git reset 5048438
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
- 此時的狀態回復到 initial 的狀態,且 file2 的更改存在暫存區。
分支功能
建議寫某個功能時,都建立一個 branch,等到確定可用在 merge 到 master
建立分支
git branch [BranchName]
- 建立分支,但所在分支不會改變
切換分支
git checkout [BranchName]
合併分支 (將某個 branch 合併到 master)
git checkout master
git merge [BranchName]
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
顯示所有分支
git log --oneline --all --graph
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
(我的被我搞得有點亂,但大致會得到這樣的畫面)