# Github ###### tags: `github` 基本的github指令 [圖解git指令](https://dev.to/lydiahallie/cs-visualized-useful-git-commands-37p1) 最常使用的功能是存檔 ``` git add . // 可以指定檔案 git commit -m "detail for commit" // 指定這次是幹什麼了 git push // push 上雲端 ``` --- 有時候 push 想要蓋過所有前面的變更 ``` git push -f ``` ### <span style="color:red">*千萬不要在跟別人協作時亂用!!!*</span> --- 拉一個分支出來 ``` git checkout -b "branch name" ``` --- 查看分支 ``` git branch ``` --- 刪除分支 ``` git branch -d "branch name" ``` --- 切換分支 ``` git checkout "branch name" ``` --- 合併分支 ``` git checkout master // 先切換到主分支 git merge "branch name" // 合併分支到主分支 ``` --- 同步分支 ``` git pull "origin master" // 同步雲端主分支到目前分支 ``` --- 另外還有PR(Pull Request) 主要是在做版控的時候使用,需要在 Github 的網頁上點。 ### ***貼心提醒*** 沒把握不要亂用rebase,新手常犯的錯誤就是不小心rebase後導致多了一堆commit,或是不小心把commit刪掉。 使用方法請[參考](https://gitbook.tw/chapters/branch/merge-with-rebase.html)
×
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