Spring Boot自定義錯誤檢視的方法詳解
阿新 • • 發佈:2020-08-12
Git 建立倉庫
初始化一個git倉庫,在執行完成git init命令後,Git 倉庫會在當前目錄生成一個 .git 目錄。
git init
如果使用指定目錄作為git倉庫
git init newrepo
初始化後,會在 newrepo 目錄下會出現一個名為 .git 的目錄
git add 命令告訴 Git 對哪些檔案進行跟蹤:
git add *.c git add README git commit -m '初始化專案版本'
以上命令將目錄下以 .c 結尾及 README 檔案提交到倉庫中。
克隆倉庫的命令格式為:
git clone <repo>
如果我們需要克隆到指定的目錄,可以使用以下命令格式:
git clone <repo> <directory>
克隆完成後,在當前目錄下會生成一個 simplegit 目錄:
git add 命令可將該檔案新增到快取(git add .命令來添加當前專案的所有檔案)
touch hello.php touch README git add README hello.php
git status 命令用於檢視專案的當前狀態。
$ git status -s
A README
A hello.php
當你要將你的修改包含在即將提交的快照裡的時候,需要執行 git add
執行 git commit 將快取區內容新增到倉庫中。
Git 為你的每一個提交都記錄你的名字與電子郵箱地址,所以第一步需要配置使用者名稱和郵箱地址。
$ git config --global user.name 'runoob' $ git config --global user.email [email protected]
示例:
$ git add hello.php $ git status -s A README A hello.php $ git commit -m '第一次版本提交' [master (root-commit) d32cf1f] 第一次版本提交 2 files changed, 4 insertions(+) create mode100644 README create mode 100644 hello.php $ git status # On branch master nothing to commit (working directory clean)
如果你覺得 git add 提交快取的流程太過繁瑣,Git 也允許你用 -a 選項跳過這一步。命令格式如下:
git commit -a
示例:
git commit -am '修改 hello.php 檔案' [master 71ee2cb] 修改 hello.php 檔案 1 file changed, 1 insertion(+)
git mv
git mv 命令用於移動或重新命名一個檔案、目錄、軟連線。
git mv README README.md