- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
首先,大局:我正在尝试为我正在运行的 Redmine/Gitolite 服务器编写一个 git post-receive 脚本。根据各种建议,我正在创建一个供 Redmine 读取的裸本地存储库,并且我正在 Gitolite 上设置一个接收后脚本以将更改推送到 Redmine 存储库。
但是,我对 Git 非常菜鸟,所以我什至不能在这里做一个简单的任务>_<。我想如果我弄清楚了这一点,我应该能够编写上面的脚本。设置我的测试存储库后,我创建了两个存储库作为测试。
(“Central Repo”是一个位于 git@localhost:testing 的 Gitolite 存储库)
cd /tmp
mkdir /tmp/test
$ git clone git@localhost:testing
$ git clone git@localhost:testing testing2
$ git clone git@localhost:testing --bare
现在当我运行 ls 时:
$ ls
testing testing2 testing.git
现在,我更改了 testing2 中的测试文件,然后将更改推送到中央仓库。
$ cd testing2
$ echo 'testline' >> test && git commit --allow-empty-message -a -m '' && git push
正如预期的那样,如果我在“testing”文件夹上运行“git pull”,一切都会按预期进行。
$ cd testing
$ git pull
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From localhost:testing
3242dba..a1ca5ba master -> origin/master
Updating 3242dba..a1ca5ba
Fast-forward
test | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
$ diff ./test ../testing2/test
$
如最后一个“diff”所示,“testing”目录和“testing2”目录完全按预期工作。 “git pull”命令同步两个目录。
但是,如果我进入 testing.git(又名:裸仓库),git fetch/git reset --soft 无法将裸仓库更新到最新版本。
$ ls
branches config description HEAD hooks info objects packed-refs refs
$ git fetch
remote: Counting objects: 5, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From localhost:testing
* branch HEAD -> FETCH_HEAD
$ git reset --soft
$ cd ..
$ git clone ./testing.git testing3
Cloning into testing3...
done.
$ cd testing3
$ diff test ../testing2/test
5a6
> testline
正如您从上一个示例中看到的,裸存储库无法更新,并且这两个文件之间存在某种差异。我做错了什么?
提前致谢
最佳答案
您的提取尚未更新 master
分支,仅更新 FETCH_HEAD
(参见“What does FETCH_HEAD
in Git mean?”)。
如“how do I pull to a bare repository?”中所述,您应该执行以下操作:
git fetch origin master:master
或者,对于 all the branches :
git fetch origin +refs/heads/*:refs/heads/*
If you want to fetch these on a regular basis, you should consider:
git config remote.origin.fetch +refs/heads/*:refs/heads/*
which will allow you to type
git fetch
to sync your branches with the remote.
Note that this make sense only in a bare repository where local branches are not supposed to be edited.
关于Git Fetch 无法处理裸仓库,但 git pull 可以处理普通仓库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10696718/
我正在运行此代码并在没有互联网连接的情况下进行测试: fetch(url, options) .then(res => { // irrelevant, as catch happens
function fetchHandler(evt) { console.log('request:' + evt.request.url); dealWithRequest(evt)
我在 AdventureWorks2016 上执行了两个示例查询,并得到了相同的结果。那么什么时候应该使用 NEXT 或 FIRST 关键字? select LastName + ' ' + Firs
我有以下查询: @Query("SELECT new de.projectemployee.ProjectEmployee(employee) " + "FROM ProjectEmpl
我正在尝试使用 fetch on react 来实现客户端登录。 我正在使用护照进行身份验证。我使用的原因 fetch而不是常规 form.submit() , 是因为我希望能够从我的快速服务器接收错
我正在尝试将我的 Aurelia 项目从 beta 版本升级到 3 月版本。 我遇到的错误之一是: Cannot find name 'Request'. 谷歌搜索会在 GitHub 上显示此问题:h
见标题。在我们的react项目中调用fetch时,一位(现已离职)开发人员最初使用from fetch to window.fetch。我不确定两者之间的区别,也无法在网上找到任何结论(W3Schoo
这个问题在这里已经有了答案: HTTP status code 401 even though I’m sending credentials in the request (1 个回答) How
这是代码片段: var fetch = require("node-fetch"); var fetchMock = require("fetch-mock"); function setupMock
我在这里看到了两种不同的抓取方式: https://github.com/github/fetch https://github.com/matthew-andrews/isomorphic-fetc
以下git命令有什么区别? git fetch origin 和 git fetch --all 从命令行运行它们看起来就像它们做同样的事情。 最佳答案 git fetch origin 仅从 ori
我有一个不断改变值的动态 json。我想用该数据绘制图表所以我将动态数据存储到数组然后用该数组绘制图表。目前我创建了 serinterval 用于从 api 获取新数据。但问题是如果新数据没有,它会再
我有一个很大的 JSON blob,我想预先加载我的网页。为此,我添加了 到我的页面。我也有一个 JS 请求来获取相同的 blob。 这不起作用,控制台报告: [Warning] The resour
我们在单页 JavaScript 应用程序发出 fetch 请求时遇到不一致的客户端错误。值得注意的是,它们都是同源请求。 let request = new Request(url, options
我是 ReactJS 的新手,我一直在阅读如何从 api 获取和发布数据。我见过这两个,但我不知道该用什么以及两者之间有什么区别?我读了它,但我不确定我会用什么。谢谢! react-fetch wha
Doctrine中注解@ManyToOne中的fetch="EAGER"和fetch="LAZY"有什么区别? /** * @ManyToOne(targetEntity="Cart", casca
我想要获取一个 api,然后调用另一个 api。在 javascript 中使用这样的代码是否明智? fetch(url, { method: 'get', }).then(function(re
我有一个组件,它依赖于 2 个端点来检索所需程序的名称。我有 2 个端点。第一个端点返回程序列表,它是一个对象数组。目前,它仅返回 4 个节目(2 个节目 ID 为“13”,另外两个节目 ID 为“1
我的应用程序从外部源(配置文件)接收查询,因此它必须从查询结果中获取列。我有一些代码: typedef union _DbField { text text[512]; sword i
我有一个实体A,它与实体B有对多关系。 Entity A -->> Entity B 我需要在多个屏幕上引用一对多关系的计数。此外,我可以多次从 Entity A
我是一名优秀的程序员,十分优秀!