# Git 操作說明 ## 下載安裝 git window https://git-scm.com/download/win 下載完成後,直接執行exe 安裝完畢後,打開command line,輸入 ``` git --version ``` 如果正常回傳給你版本資訊,代表安裝成功 ## git 工具說明 可使用指令的方式,或另外下載source tree(圖形化介面) ### 指令工具說明 在你要儲存的資料夾右鍵,顯示其他選項  選擇open git bash here  即可開啟 git bash 介面  ### source tree工具說明 如果想要使用圖形化介面,我個人建議使用source tree工具,比較好看也比較好操作 下載 sourcetree https://www.sourcetreeapp.com/ 執行 setup.exe 1.有這個帳號在去設定,不然就skip  2.直接next即可,他其實會去下載git工具,但建議還是都要知道怎麼用  3.輸入你的名字跟email,但不用真實的,他只是幫你設定之後你git操作的資訊,之後還是可以變更  4看到這個就no即可,要設定之後也可以設定  ## git 操作說明 ### git clone git clone的功能就是,將你要的此版控的設定以及檔案都存放下來,包誇code,此版控的歷史訊息,版控的設定....等 首先你要先取得你要 clone 下來的網址 github來說,位置在這  複製網址 #### git bash 然後在 bash 輸入 ``` git clone https://xxx.xxx.xxxxx ``` #### sourcetree 選擇clone  輸入資訊  ### git pull #### git bash 從線上repository取得程式合進本地repository裡  git pull 中,包含 git fetch,所以可以直接執行pull即可 #### sourcetree 直接點pull按鈕  ### git commit #### git bash 新增修改完程式或文件後,要進行 ``` git add ```  將還沒給git列管的檔案加進本地repository 如果有大量 untracked files 則使用 ``` git add . ``` 完成之後,進行commit ``` git commit -a -m "敘述一下做了些什麼" ```  #### sourcetree 使用sourcetree可以直接點+號 或直接stage all,完成add的功能  然後點擊左上角commit按鈕  填寫commit敘述,然後按下右下角commit  ### git push 將本地repository儲存到線上repository #### git bash  #### sourcetree 點選push即可 
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up