git

作者: 汪南 | 来源:发表于2015-12-19 09:19 被阅读0次

1、git clone -b branchName [remote repository address] 克隆指定分支 

git clone [remote repository address]  克隆主分支

git clone -b branchName  [remote repository address]  [local address]克隆指定分支到本地指定目录( eg:git clone -b company-em https://wangweiwen@bitbucket.org/wangweiwen/em.git em2;)

2、对于 git 来说, 它明明要三个参数「push」「origin」以及「A:A」的,你却给它五个:「push」「origin」「A」「:」「A」。

PS:git push origin A:A可简写为git push orgin A。

3、git checkout -b <new_branch> 检出命令git checkout 通过参数-b 实现了创建分支和切换分支两个动作的合二为一

4、查看远程分支:git branch -a

    查看本地分支 : git branch

    删除本地分支:git branch -d branchName

5、查看提交记录

    git log --graph --decorate --all

    git log --graph --decorate --pretty=oneline --abbrev-commit --all

6、git checkout . #本地所有修改的。没有的提交的,都返回到原来的状态

     git stash #把所有没有提交的修改暂存到stash里面。可用git stash pop回复。

7、git log 查看commit的历史    git show 查看某次commit的修改内容  git log -p 查看某个文件的修改历史    git log -p -2查看最近2次的更新内容

8、克隆远程指定分支:git clone -b b1 https://github.com/...

相关文章

网友评论

      本文标题:git

      本文链接:https://www.haomeiwen.com/subject/cdnphttx.html