赞
踩
程序媛用动画图解Git命令,一看就懂!
https://mp.weixin.qq.com/s/sCi_DE1urP1OE13wbgFHUg程序媛用动画图解Git命令
查看分支
Git fetch 取来变更
GIT rebase 最新的合并
git submodule update ./batch_v2
利用git进行代码的管理是非常方便的。这里我们有三种最常见的仓库建立方法:
1、创建一个完全空的仓库
2、从本地已有的项目文件创建
3、从现有的git存储库添加
1、创建一个完全空的仓库
先在网页远端创建好仓库,再clone到本地,再将文件添加到仓库,再推送到远端
例如:
git clone https://git.*******/yourname/test.git
cd test
touch README.md
git add README.md
git commit -m “add README”
git push -u origin master
2、从本地已有的项目文件创建
本地已经创建好文件夹,将本地文件夹与远端仓库关联。
cd existing_folder
git init #初始化本地仓
git remote add origin https://git.*****./yourname/test.git #关联远端仓库
git add .
git commit
git push -u origin master
3、从现有的git存储库添加
cd existing_repo
git remote add origin https://git.*****./yourname/test.git
git push -u origin --all
git push -u origin --tags
————————————————
版权声明:本文为CSDN博主「jaycain」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/weixin_43572595/article/details/109537031
提交到本地版本库
Git branch
git checkout -b 分支名
每一个ticket都要新建一个branch
git reset --hard log的标记符 工作区退回想要的版本上去
git reset --hard origin/develop/2.10.0_k4w1 切换到想要的远程分支
git diff --stat 看看有哪些文件没有改回来
git submodule update -f devices/ bin/generator/sdk_generator/ CMSIS/ 本地与远程文件有冲突,需要手动跟新的子模块更新的的文件(这些文件不同的话,提交肯定报错的)
或者:
git rebase origin/develop/sdk_api_2.x 保证每个都有一个新的提交(基于远程分支)把同步远程内容同步到本地,把当前的分支节点,放在对应的分支上,全部更新
或者直接:
切换到远程分支
步骤1:先在本地创建1.1分支并与远程分支建立联系
命令 : git checkout - b 1.1 origin/1.1
解释 : 此行命令表示 本地创建1.1 分支,并切换到本地1.1分支 并与远程分支建立联系
————————————————————————————————————————————
————————————————————————————————————————————
git add -u platform/drivers/ccm32k/ 只要有修改,必须都要提交到本地,才能push
如果报:File platform/drivers/otfad/fsl_otfad.c is not formated according to the coding standard.
Git reset HEAD some/file 取消已暂存但未提交的变更的暂存标识
ruby helper.rb -c 注意新的改动在本地,所以还要在加入暂存区一次
git add 文件
git diff --cached 对比暂存区与版本库的区别 cached本地版本库 HEAD当前的点
U 提交带签名signed-off
git commit --amend 文件 修改最近一次提交,或修改提交过的文件和备注
git show --stat 显示提交修改内容 stat统计信息,添加或删除了多少行
git rebase origin/主分支 一定一定先要rebase 把同步远程内容同步到本地 Git log 查看自己的提交改动日志,比远程新的本地提交,都将push上去
$$$ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。