常用git命令

git status

git log (q退出)

git log --graph --abbrev-commit --decorate --date=relative --all
git log --graph --oneline --decorate --all

$ git log --oneline

git log  --graph --all

git log --author=XX

git log --oneline --before={3.weeks.ago} --after={2016-01-01} --no-merges

如果你要指定日期,可以执行几个选项:--since 和 --before,但是你也可以用 --until 和 --after。

git branch

git branch branchname

git checkout branchname

git checkout -b myfeature

git checkout -b myfeature develop

git merge --no-ff myfeature
git branch -d myfeature
git push origin develop

git commit -a -m "Bumped version number to 1.2"

推送本地分支local_branch到远程分支 remote_branch并建立关联关系

      a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch

          git push

     b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch

         git push -u origin remote_branch

     c.远程没有remote_branch分支并,本地已经切换到local_branch

        git push origin local_branch:remote_branch


一、列出标签

$ git tag # 在控制台打印出当前仓库的所有标签

二、搜索标签

$ git tag -l ‘v0.1.*’ # 搜索符合模式的标签

三、推送标签到远程仓库

git push并不会把tag标签传送到远端服务器上,只有通过显式命令才能分享标签到远端仓库。
1.push单个tag,命令格式为:git push origin [tagname]
例如:
git push origin v1.0 #将本地v1.0的tag推送到远端服务器
2.push所有tag,命令格式为:git push [origin] --tags
例如:
git push --tags

git push origin --tags
---------------------  
作者:elena_w  
来源:CSDN  
原文:https://blog.csdn.net/github_27263697/article/details/79563949

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章