当前位置:首页 > git > 正文

git常用命令 菜鸟教程

  • git
  • 2024-09-22 22:28:43
  • 7240
1、Git&Repo最基本命令菜鸟教程前言:知道新朋友对git和repo命令不是特别熟悉,所以总结了一下git和repo最基本的命令。
****************************回购*******************************************
repoinit-ussh://git@gitlab manifest.git-b[branch]
reposync
repostatus
repobranch
repomanifest
repodiff
repohelp
************************查看*************************************
1.查看本地分支
gitbranch
2.查看远程分支
gitbranch-r
3.查看所有分支
gitbranch-a
4.查看状态
gitstatus
5.查看提交日志
gitlog
************************创建*************************************
在本地创建新分支
gitbranch[branchname]
切换到新分支
gitcheckout[branchname]
创建+切换分支
gitcheckout-b[分支名称]
************************删除*************************************
删除本地分支
gitbranch-d[分支名称]
删除github远程分支
gitpushorigin:[分支名称]
****************************推***************************************
推送新分支到github
gitpushorigin[分支名称]
提交分支数据到远程服务器
gitpushorigin:
示例:
gitpushorigin2.0.1.20120806:2.0.1.20120806
远程分支和本地分支,因此从服务器拉取特定分支时需要指定远程分支的名称。
gitcheckout--trackorigin/2.0.1.20120806
该命令包含--track参数,所以你需要git1.6.4或更高版本!这将自动导致git切换到您的分支。
****************合并分支合并******************************************
gitmergefeature/login
gitmergedamo_release_201020_feedingRank
************************标签****************************************
gittag2.0.2
gitpush--tag
1.远程端指定分支(本地不存在)
gitfetch
gitcheckout-b本地分支名称原/远程分支名称
2.创建本地分支并将其推送到远程
(2)。 将本地分支推送到远程仓库
gitpush--set-upstreamorigin分支名称
将本地分支推送到远程端:
repoforall-cgitpushikadamo_:damo_
设置本地分支与远程端的连接跟踪:
repoforall-cgitbranch--set-upstream-to=module/damo_damo_
设置本地分支和远程分支跟踪:
gitbranch--set-upstream-to=origin/远程分支名称本地分支名称
根据远程分支设置分支创建:
1首先,获取远程ila_210120。
repoforall-cgitfetchilaila_210120
2,然后基于远程ila_210120创建damo_ila_210120分支。
repoforall-cgitcheckout-bdamo_ila_210120ila/ila_210120
cherry-pick:(特定提交)
gitcherry-pickf8857cbb08519b10981b0e2df999363ebfe8b6d3
推送到远程端
gitpushiladamo_ila_210120_review
强推:
gitpush--forceila201140_newGuide_oneCommit
提交流程综合:
1.创建一个新分支:
2.首次提交:
3.重新提交:
重置差异:
repoforall-cgitreset--hard
repoforall-cgitreset--softf8857cbb08519b10981b0e2df999363ebfe8b6d3

1.https://www.cnblogs.com/mmykdbc/p/9076063.html
2.https://blog.csdn.net/top_code/post/details/51931916
3.https://www.jianshu.com/p/bf7b09e234c8
4.模板:https://blog.csdn.net/weixin_38019025/post/details/103951002
Control+C终止终端作。
6.
~/.
/user/yuyahui