简体   繁体   English

Pharo gitFileTree:如何阻止提交(仅阶段)

[英]Pharo gitFileTree: how to block commit (stage only)

How can I config gitFileTree/Monticello don't commit on project save ? 如何配置gitFileTree / Monticello不要在项目保存时提交?

I have some out-of-tree files in local git repo (autogenerated sources) and I want to do commit manually : 我在本地git repo(自动生成的源代码)中有一些树外文件,我想手动提交

  • first stage all changes in Smalltalk system, then 首先是Smalltalk系统中的所有更改,然后
  • stage all external files and 暂存所有外部文件并
  • commit all changes at once 一次提交所有更改

Say you want to "export" package called Somewhere to GitFileTree repository called breaking-mcz . 假设您想将名为Somewhere包“导出”到名为breaking-mcz GitFileTree存储库。

"get the package"
package := 'Somewhere' asPackage.

"find the repo"
repo := MCRepositoryGroup default repositories detect: [ :each | (each isKindOf: MCFileTreeGitRepository) and: [ each location includesSubstring: 'breaking-mcz' ] ].

"working copy is the current in-image state"
workingCopy := package mcWorkingCopy.

"this will create an in-memory only version; the message doesn't matter"
pseudoVersion := workingCopy newVersionWithMessage: 'Message will not be used' in: repo.

"this will file-out the current state to disk, and `git add` it to git index (no commit)"
repo internalStoreVersion: pseudoVersion.

Note 1: keep in mind that the way GitFileTree works is that it clears the old code on the disk and dumps everything again, so if you already have some uncommitted modifications in the code (on the disk), you should git stash them first. 注意1:请记住,GitFileTree的工作方式是清除磁盘上的旧代码并再次转储所有内容,因此,如果您已经对代码(在磁盘上)进行了一些未提交的修改,则应先git stash它们。

Note 2: I am assuming you are using metadata-less GitFileTree (which has been the default for a year or so), otherwise I am not sure what would happen to history/ancestry 注意2:我假设您使用的是无元数据的GitFileTree(默认设置已经一年左右了),否则我不确定历史/祖先会发生什么

Note 3: This is not a typical use case, so there's no GUI for this, but we could consider in Iceberg at some point 注意3:这不是典型的用例,因此没有GUI,但是我们可以考虑在Iceberg中使用

You could simply add a filetree repository which will just store the package to disk and not do any git versioning. 您可以简单地添加一个文件树存储库,该存储库仅将软件包存储在磁盘上,而不进行任何git版本控制。 Then you commit that manually. 然后,您手动提交。 This actually used to be the workflow before GitFileTree. 这实际上曾经是GitFileTree之前的工作流程。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM