常用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

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