Git
我是前言
目的:搭建好了博客,不可能每次发表博客的时候都带着我这台台式机乱跑吧,如果换到其他电脑怎么办,博客的部署文件都在这台电脑上,所以就想着同步到github上,又不想创建一个新的repo还单独存储源文件,就像在发布的网站的repo中创建一个分支来存储当前的blog源文件,于是风雨之路慢慢而来,因为这几天要过10.1,所以赶紧整理一下这两天git的学习内容
准备工作
- 创建repo然后创建本地库,git pull 远程库 如下图
创建分支

git checkout - b Hexo //Hexo 是分知名 创建并切换到当前分支
//等价于下面
git branch Hexo
git checkout Hexo //
示意图
远程repo上查看
本地命令行查看
查看本地分支:
git branch
如图
查看远程分支:
git branch -r
如图

删除分支
创建删除都是常用的,我就一并归纳了,虽然还没用到
git branch -d Hexo
切换分支
git checkout master (前面提到的)切换到主分支
将本地分支push到远程分支
git push origin [name]
补充方法
git push origin test :master //将本地test分支作为远程的master分支
git push origin test : test //将本地的test分支作为远程的test 分支
遇到的问题
1.hexo的两个主题 git commit 时无法提交
报错信息:
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
(commit or discard the untracked or modified content in submodules)
modified: themes/next (modified content)
no changes added to commit (use "git add" and/or "git commit -a")```
解决方案:
Bean HE http://kubiops.com/2015/09/06/ignore-dirty-status/
问题分析:
* 主要是看了解决方法,并不是真正的将主题提交,而是ignore dirty(肮脏的) info in git ,所以我断定应该是github上开源的项目在提交的时候会自动连接到github上的远程库,去查看了一下远程库的状态,如下图
参考
- springbarley的博客http://www.cnblogs.com/springbarley/archive/2012/11/03/2752984.html
- 海岛心hey http://www.imooc.com/article/9707
- git中文官网https://git-scm.com/book/zh/v1/Git-分支-分支的新建与合并
- segmentfaulthttps://segmentfault.com/q/1010000000181403
- 阮一峰网络日志http://www.ruanyifeng.com/blog/2012/07/git.html
- git提交问题参考Bean He http://kubiops.com/2015/09/06/ignore-dirty-status/

本文来自博客园,作者:严_青,转载请注明原文链接:https://www.cnblogs.com/zhao-jie-li/p/5921093.html
标签:
计算机基础
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】Flutter适配HarmonyOS 5知识地图,实战解析+高频避坑指南
【推荐】凌霞软件回馈社区,携手博客园推出1Panel与Halo联合会员
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何反向绘制出 .NET程序 异步方法调用栈
· 领域驱动设计实战:聚合根设计与领域模型实现
· 突破Excel百万数据导出瓶颈:全链路优化实战指南
· 如何把ASP.NET Core WebApi打造成Mcp Server
· Linux系列:如何用perf跟踪.NET程序的mmap泄露
· 聊聊 ruoyi-vue ,ruoyi-vue-plus ,ruoyi-vue-pro 谁才是真正的
· C#开发的Panel滚动分页控件 - 开源研究系列文章
· 如何反向绘制出 .NET程序 异步方法调用栈
· ShadowSql之开源不易
· Java 原生异步编程与Spring 异步编程 详解