Wake Me Up When September Ends.

A wanderer capable of grasping the beauty of the grass, with a heart full of ancient charm, and a fondness for playful wit. Those who understand my words are knowledgeable individuals; those who decipher my code truly comprehend the essence. I am a wandering code swordsman, carrying my skills and riding freely through the digital world.

本篇文章记录git一些常见问题解决,不定时更新!

1.You asked to pull from the remote ‘gitea’, but did not specify a branch. Because this is not the default configured remote for your current branch, you must specify a branch on the command line

这个错误提示说明在从远程仓库拉取代码时没有指定分支。由于当前分支不是默认配置的远程分支,所以需要在命令行中指定分支。

要解决这个问题,可以使用以下命令来拉取指定分支的代码:

git pull <remote> <branch>

2.error: RPC 失败。HTTP 413 curl 22 The requested URL returned error: 413 send-pack: unexpected disconnect while reading sideband packet

这个错误提示说明推送包(push package)太大了,超过了服务器所允许的大小限制。

要解决这个问题,有如下操作:

1.增加 Git 中缓存的默认限制:

git config --global http.postBuffer 10240000000

2.服务端是用nginx反向代理的,修改nginx配置:

server {
    // 其他配置省略
    client_max_body_size 500m;
}

3.fatal: 拒绝合并无关的历史

这个错误通常发生在尝试合并两个没有共同历史的分支时。解决这个问题的一种方法是使用–allow-unrelated-histories选项来强制合并。命令如下:

git merge --allow-unrelated-histories <branch_name>

这个命令将允许你合并两个没有共同历史的分支。如果有冲突发生,需要解决冲突并手动提交合并结果。

4.查看某个文件提交记录

要查看文件在Git中的提交记录,可以使用以下命令:

git log -- <file_path>

其中是您想要查看提交记录的文件路径。这个命令将显示指定文件的提交历史,包括提交者、提交信息、提交时间等信息。

如果您只想查看最近的提交记录,您可以使用-n选项来指定要显示的提交记录数量,例如:

git log -n 5 -- <file_path>

这将显示最近的5次提交记录。

另外,如果您想查看某个特定文件在每次提交中的变更,您可以使用以下命令:

git log -p -- <file_path>

这个命令将显示每次提交对指定文件所做的具体变更。

5.从远程checkout分支并关联

git  checkout -b <branch_name> <remote>/<branch_name>

or

git  checkout --track <remote>/<branch_name>

本篇文章记录php的composer组件包一些用法!

引用本地未发布的包

要引用本地未发布的包,只需要在composer.json中repositories仓库为为本地项目地址即可,如下所示:

{
    "repositories": [
        {
            "type": "path",
            "url": "/path/to/local/package"
        }
    ],
    "require": {
        "your-package": "dev-master"
    }
}
阅读全文 »

时常记不住定时任务一些配置规则,所以这边记录一下!☘

Cron 定时任务是一种在 Unix/Linux 系统中用于执行预定时间间隔的任务的机制。它使用 cron 表达式来定义任务的执行时间。

Cron 表达式由空格分隔的五个字段组成,分别表示分钟、小时、日期、月份和星期几。每个字段可以接受不同的取值范围和特殊字符。

minute   hour   day   month   week   command     顺序:分 时 日 月 周
阅读全文 »

工厂模式是一种创建型设计模式, 其在父类中提供一个创建对象的方法, 允许子类决定实例化对象的类型。

需求的场景

这种模式在面试中经常会被问到,很多面试题的答案会表示该模式经常用于框架的db或cache组件设计。

假设你所在项目组在开发某个项目中,使用了多种缓存数据源,比如有内存,redis,本地文件。目前每次根据不同场景使用不同类型缓存,需要实例化不同缓存实例进行操作,比较繁琐。项目组开发人员希望统一调用缓存入口,简化缓存调用心智负担。

如何解决

  1. 定义cache工厂类(父类)和依赖类
  2. 编写各个类型cache子类
  3. cache工厂类创建调用
    阅读全文 »