美文网首页
Git & Repo 最基本命令 菜鸟教程

Git & Repo 最基本命令 菜鸟教程

作者: fcf7850dd33e | 来源:发表于2021-04-22 16:45 被阅读0次

前言:发现新来小伙伴,对git以及repo命令还不是特别熟悉,因此对git及repo最基本命令做了一下小结:

************************Repo*************************************

repo init -u ssh://git@gitlab...manifest.git -b [分支]

repo sync

repo status

repo branch

repo manifest 

repo diff

repo help

************************查看*************************************

1、查看本地分支

git branch

2、查看远程分支

git branch -r

3、查看所有分支

git branch -a

4、查看状态

git status

5、查看提交日志

git log

************************创建*************************************

本地创建新的分支

git branch [branch name]

切换到新的分支

git checkout [branch name]

创建+切换分支

git checkout -b [branch name]

************************删除*************************************

删除本地分支

git branch -d [branch name]

删除github远程分支 

git push origin :[branch name]

************************推送*************************************

将新分支推送到github

git push origin [branch name]

提交分支数据到远程服务器

git push origin <local_branch_name>:<remote_branch_name>

例如:

git push origin 2.0.1.20120806:2.0.1.20120806

远程分支和本地分支需要区分好,所以,在从服务器上拉取特定分支的时候,需要指定远程分支的名字。

git checkout --track origin/2.0.1.20120806

注意该命令由于带有--track参数,所以要求git1.6.4以上!这样git会自动切换到分支。

************************分支合并merge*************************************

git merge feature/login

git merge  damo_release_201020_feedingRank

************************tag*************************************

git tag 2.0.2

git push --tags

1、拉取远端指定的分支(本地不存在)

git fetch

git checkout -b 本地分支名 origin/远程分支名

2、创建本地分支,并推送到远端

(二).推送本地分支到远程仓库

git push --set-upstream origin 分支名

本地分支推送到远端:

repo forall -c git push ika damo_:damo_

本地分支与远端建立关联跟踪:

repo forall -c git branch --set-upstream-to=module/damo_  damo_

设置本地分支与远程分支的追踪:

git branch --set-upstream-to=origin/远程分支名 本地分支名

基于远端分支创建分支:

1、先fetch 远端的 ila_210120

repo forall -c git fetch ila ila_210120

2、基于远端的ila_210120创建  damo_ila_210120分支

 repo forall -c git checkout -b damo_ila_210120 ila/ila_210120

cherry-pick:(某一个commit

git cherry-pick f8857cbb08519b10981b0e2df999363ebfe8b6d3

push推送到远端

git push ila damo_ila_210120_review

强推:

git push --force ila 201140_newGuide_oneCommit

合成一个commit流程:

1、创建一个新分支:

2、reset到第一个commit:

3、重新commit:

reset区别:

repo forall -c git reset --hard

repo forall -c git reset --soft f8857cbb08519b10981b0e2df999363ebfe8b6d3

1、https://www.cnblogs.com/mmykdbc/p/9076063.html

2、https://blog.csdn.net/top_code/article/details/51931916

3、https://www.jianshu.com/p/bf7b09e234c8

4、template模板:https://blog.csdn.net/weixin_38019025/article/details/103951002

Control + C 退出终端执行的任务

6、电脑目录:

~/.

/Users/yuyahui

相关文章

  • Git & Repo 最基本命令 菜鸟教程

    前言:发现新来小伙伴,对git以及repo命令还不是特别熟悉,因此对git及repo最基本命令做了一下小结: **...

  • git学习以及github使用

    [TOC] 参见菜鸟学院http://www.runoob.com/git/git-remote-repo.htm...

  • Git教程笔记

    Git教程笔记 Git教程-菜鸟教程 1. Git 安装配置 1.1 Linux | Windows | Mac...

  • Git笔记

    资料 Git教程(廖雪峰) Git教程(菜鸟教程) Git - 简明指南 Git官网 首次创建 创建用户 进入代码...

  • 自动化脚本实践(Shell + Expect)

    Linux Shell脚本入门: Linux awk 命令 | 菜鸟教程 Shell 教程 | 菜鸟教程 lin...

  • Mac下手动安装atom插件(package)

    工具 git git clone命令node.js npm命令atom 搜索查找特定的插件 点击Repo进入插...

  • git相关教程汇总

    1. git常用命令 git常用命令总结git常用命令讲解 2. git教程相关网站 廖雪峰的git教程猴子都能懂...

  • git 命令

    Git常用命令总结Git常用命令总结 git init 在本地新建一个repo,进入一个项目目录,执行git ...

  • Failed to connect to github.com

    在使用git push original master | pod repo add 等git pod命令时可能会...

  • Git笔记

    Git介绍 本文根据廖老师的Git教程归纳 Git命令 Git配置 git config命令的--global参数...

网友评论

      本文标题:Git & Repo 最基本命令 菜鸟教程

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