整理了一下在測(cè)試過(guò)程中常用的Git ?命令,持續(xù)更新.......
1.git branch
git branch ? ? ? 查看本地分支
git branch -r ? ?查看遠(yuǎn)程分支
git branch -a ? 查看所有分支,包括遠(yuǎn)程的分支
git branch -D br ? ? 刪除本地分支(br 指分支名)
git branch br ? ?創(chuàng)建本地分支br
2.git pull
git pull <遠(yuǎn)程主機(jī)名> <遠(yuǎn)程分支名>:<本地分支名>
eg. ? git pull origin next ? ? 取回origin/next分支,再與當(dāng)前分支合并
想當(dāng)于
git fetch origin
git merge origin/next
3.git push
git push <遠(yuǎn)程主機(jī)名> <本地分支名>:<遠(yuǎn)程分支名>
git push origin test:master ? ? ? ? 提交本地test分支 作為 遠(yuǎn)程的master分支
git push origin :br ? ? 刪除遠(yuǎn)程分支,推送一個(gè)空的本地分支到遠(yuǎn)程分支(origin 后面有空格)
#等同于
git push origin --delete br
4.切換分支
git checkout br
其中
git branch br ? ?git checkout br ? ---> ? git checkout -b br
5.查看遠(yuǎn)程主機(jī)名
git remote