--- title: Git Commnad tags: Git, Gitlab description: Gitlab Commnad --- # Git Commnad ## git 常用 command 紀錄 ### 上傳到 master ``` $ git init $ git add <filename> $ git commit -m <description> $ git push -u origin ``` ### 上傳到 branch ``` $ git init $ git add <filename> $ git commit -m <description> $ git checkout -b <branch> $ git push -u origin <branch> ``` ### 查看目前分支 ``` $ git status ``` ### 建立一個新的分支 ``` $ git checkout -b <branch> ``` ### 查看所有分支 ``` $ git branch --all ``` ### 查看遠端分支 ``` $ git branch -r ``` ### 從本地推上遠端分支 (遠端沒有分支情況下) remote add 綁上遠端分支 5g-use-case 組織底下 ai_platform fold ``` $ cd <folder> $ git init $ git add . $ git commit -m <description> $ git remote add origin http://10.101.6.80/5g-use-case/ai_platform.git $ git push -u origin master ``` ### 刪除本地分支 ``` $ git branch -D <branch> ``` ### 刪除遠端分支 ``` $ git push origin :<branch> ``` ![](https://i.imgur.com/GODUJkh.png) ## 參考 * https://ithelp.ithome.com.tw/articles/10280309 * https://www.twblogs.net/a/5c820077bd9eee35cd6984cb * https://www.gushiciku.cn/pl/pGvF/zh-tw * https://ithelp.ithome.com.tw/articles/10211148 * https://www.796t.com/article.php?id=68796 ## Thank you! :dash: You can find me on - GitHub: https://github.com/shaung08 - Email: a2369875@gmail.com