2019-08-09 git常规操作

2019-08-09  本文已影响0人  zxh123456

查看分支

1.本地分支

$ git branch
*master

2.远程分支

$ git branch -r
  origin/Dev
  origin/HEAD -> origin/master
  origin/xxx
  origin/xxxxxx
  origin/master

3.所有分支

$ git branch -a
 * master
  remotes/origin/Dev
  remotes/origin/HEAD -> origin/master
  remotes/origin/xxx
  remotes/origin/xxxxxx
  remotes/origin/master

将远程分支clone到本地,并且创建新分支

$ git checkout -b zhuxinhua remotes/origin/xxx
Branch 'zhuxinhua' set up to track remote branch 'xxx' from 'origin'.
Switched to a new branch 'zhuxinhua'

常规操作

//获取本地git状态
$ git status 

//添加所有修改的文件
$ git add .   

//commit
$ git commit -m '修改记录说明'

//push
$ git push

//获取git版本记录
$ git log

//获取某个文件修改记录(后面跟上文件绝对路径,直接将文件拖进终端)
$ git log /Users/mac/Desktop/ThirdEyeFrog/VRFrog/VRFrog/UMShareNeBool.m

//将hotfix分支合并到master
$ git checkout master
$ git merge hotfix

上一篇下一篇

猜你喜欢

热点阅读