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

[个人笔记] Git的CLI笔录

Git - CLI笔录

Git的CLI笔录

  • Git - CLI笔录
  • Git的CLI笔录


Git的CLI笔录

origin: 表示远程仓库节点名称。 当有多个远程仓库时 可新增远程仓库节点名称如 new_origin | new_remote
origin/HEAD: 表示当前Git仓库默认分支的引用,通常指向origin/master或origin/main
git symbolic-ref refs/remotes/origin/HEAD	# 查看origin/HEAD引用所指向的分支--------------------------------------------------------------
git branch 				# 查看本地分支
git branch <branch>		# 本地创建<branch>分支
git branch -r			# 只显示远程分支,不显示本地分支
git branch -a			# 查看完整显示(远程分支+本地分支)
git branch -M main		# 强制重命名主分支为main
git branch -d <branch>	# 删除本地的<branch>分支
git checkout <branch>	# 本地分支切换到<branch>分支(前提是<branch>分支已存在)
git branch -u new_origin/<branch>		# 切换当前对应的远程分支,切换到new_origin仓库的<branch>分支
git remote -v				# 查看远程仓库
git remote update			# 同步远程Git仓库和本地仓库
git remote add origin <URL>	# 添加远程Git仓库URL
git remote remove <URL>		# 删除远程Git仓库URL--------------------------------------------------------------
git pull = git fetch + git mergegit fetch origin			# 同步本地仓库
git fetch <URL> <branch>	# 从远程Git仓库中获取<branch>分支到本地
git merge origin/<branch>	# 把远程Git仓库的<branch>分支合并到当前分支(合并到origin/HEAD分支)
git pull <branch>			# 拉取远程的<branch>分支到本地主分支(main/master)
git pull origin <remote_branch>:<local_branch>		# 拉取远程的<remote_branch>分支到本地的<local_branch>分支
git push origin <branch>	# 将本地的<branch>分支推送到远程Git仓库(自动创建<branch>分支)
git push origin <remote_branch>:<local_branch>		# 将本地的<local_branch>分支推送到远程Git仓库的<remote_branch>分支
git push -f origin <remote_branch>:<local_branch>	# (强制)将本地的<local_branch>分支推送到远程Git仓库的<remote_branch>分支
git push origin -d <branch>		# 删除远程Git仓库的<branch>分支--------------------------------------------------------------
git clone <URL>			# 克隆远程Git仓库xxx项目到本地
git add .				# 提交全部文件 | 指定文件
git commit -m 'desc'	# 提交请求并添加描述 --------------------------------------------------------------
git reflog							# 查看本地提交操作编号
git reset --hard xxx				# 回退到指定hard编号的提交操作
git push -f origin master:master	# 本地master强制覆盖到远程Git仓库master分支--------------------------------------------------------------
--------------------------------------------------------------
--------------------------------------------------------------
### 本地已有项目文件, 需要同步到 远程Git仓库 /Github仓库, 操作的全流程如下
# 进入项目的根目录路径
echo '# project description' >> README.md
git init
git add .
git commit -m 'commit v1.0.0 open source code.'
git branch -M main
git remote add origin <URL>
git push -u origin main
http://www.lryc.cn/news/247643.html

相关文章:

  • 如何运行C/C++程序
  • HTML中input标签的23种type类型
  • 接口多态与方法多态
  • js小技巧|如何提取经过Function函数混淆了的代码
  • 【GitLab】流水线入门
  • es 中文前缀短语匹配(搜索智能补全)
  • 机器学习之决策树及随机森林
  • 用通俗的方式讲解Transformer:从Word2Vec、Seq2Seq逐步理解到GPT、BERT
  • 数据结构-01-数组
  • 甘草书店记: 2023年10月11日 星期三 晴 「做有光的人,照亮他人,也引人同行」
  • 让 OpenAI GPT4 出 10 道题测试其他开源大语言模型
  • 动态库与静态库
  • pdf文件编辑,[增删改查]
  • 如何与LEONI建立EDI连接?
  • 算法中的时间复杂度,空间复杂度
  • Python基础:推导式(Comprehensions)详解
  • 安防监控视频融合平台EasyCVR定制化页面开发
  • Roll-A-Ball 游戏
  • 医疗影像数据集—CT、X光、骨折、阿尔茨海默病MRI、肺部、肿瘤疾病等图像数据集
  • Linux僵死进程及文件操作
  • 用Python写一个浏览器集群框架
  • 【Github】git安装
  • sql语法大全
  • 小红书API接口测试 | 小红书笔记详情 API 接口测试指南
  • 实验六:Java流式编程与网络程序设计
  • 金字塔原理
  • VR全景技术助力政务服务大厅数字化,打造全新政务服务体验
  • 使用Python实现SVM来解决二分类问题
  • 合并PDF出现OOM异常
  • c语言-数据结构-链式二叉树