git add 新檔案 將工作區域的**新增到暫存區
git commit -m "first add" 將暫存區檔案提交到本地倉庫中
git push -u origin master 將倉庫檔案推送的到遠端倉庫的主分支中
git branch 檢視分支
git branch 分支名 建立分支
git checkout 分支名 切換分支
git checkout -b 分支名 建立並且換到分支
git 如何把分支**合併到master主分支上
git checkout dev 首先切換到分支
git checkout master 切換到主分支
git merge dev .把分支的**merge到主分支
git push 或者 git push -u origin master (需要輸入使用者和密碼)推上去ok完成,現在 你自己分支的**就合併到主分支上了
administrator@sky-20190610aat mingw64 ~/desktop/cart (dev)
$ git branch
* dev
master
administrator@sky-20190610aat mingw64 ~/desktop/cart (dev)
$ git pull [email protected]:abang007/cart.git
from github.com:abang007/cart
* branch head -> fetch_head
already up to date.
administrator@sky-20190610aat mingw64 ~/desktop/cart (dev)
$ git checkout master
switched to branch 'master'
your branch is up to date with 'origin/master'.
administrator@sky-20190610aat mingw64 ~/desktop/cart (master)
$ ls
desktop.ini logs/ mvnw* mvnw.cmd pom.xml src/ start.bat target/ web/
administrator@sky-20190610aat mingw64 ~/desktop/cart (master)
$ git merge dev
updating 7916097..f4779bd
fast-forward
a.txt | 0
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a.txt
administrator@sky-20190610aat mingw64 ~/desktop/cart (master)
$ ls
a.txt logs/ mvnw.cmd src/ target/
desktop.ini mvnw* pom.xml start.bat web/
administrator@sky-20190610aat mingw64 ~/desktop/cart (master)
$ git push -u origin master
enumerating objects: 3, done.
counting objects: 100% (3/3), done.
delta compression using up to 4 threads
compressing objects: 100% (2/2), done.
writing objects: 100% (2/2), 250 bytes | 250.00 kib/s, done.
total 2 (delta 1), reused 0 (delta 0)
remote: resolving deltas: 100% (1/1), completed with 1 local object.
remote:
remote: github found 1 vulnerability on abang007/cart's default branch (1 moderate). to find out more, visit:
remote:
remote:
to 7916097..f4779bd master -> master
branch 'master' set up to track remote branch 'master' from 'origin'.
administrator@sky-20190610aat mingw64 ~/desktop/cart (master)
git常用的命令
1.複製版本庫 研發人員首先clone整個版本庫 git clone git git clone git 2.建立分支 預設clone下來的git庫只包含master本地分支 master remotes origin head origin master remotes origin r91p1 ...
常用的Git命令
git add 檔案 新增檔案到暫存區 git add 則新增當前工作區全部檔案,當然忽略的檔案除外。git commit m 說明 也有不是新增說明直接提交的方法,但是強烈建議使用這個。git status 檢視當前工作區的狀態,不解釋,這個應該是最常用的吧。git log 檢視git日誌 git...
git常用的命令
2.使用不同的顏色顯示 git config global color.ui auto 3.初始化倉庫 前往倉庫 cd 倉庫路徑 初始化 git init 4.新增當前倉庫中要提交的檔案到暫存區 git add 5.檢視狀態 os x命令列下,綠色為可以提交狀態,紅色則不可以 git status ...