javascript - 美化 github 上 pull 请求之前/之后的所有文件

标签 javascript node.js git github travis-ci

有没有办法让 github 上创建 pull 请求时,运行一些 npm 命令(例如 npm run beautify)后自动创建一个新的 pull 请求,这样我就不必担心美化过程。

如果可以完成这样的事情,自动将提交添加到当前的 pull 请求中,从而美化所有文件,即使这样也可以正常工作。

我可以使用任何免费的第三方软件(Greenkeeper、travis 或其他软件)

最佳答案

您可以在服务器和本地使用 git hook,或者设置本地过滤器(涂抹/清理)来美化您的代码,然后再将其提交到存储库。

Git Hook

阅读official docs以获得完整的引用。

<小时/>

涂抹/清洁

阅读所有相关内容并在此处进行设置:
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes

It turns out that you can write your own filters for doing substitutions in files on commit/checkout.

These are called clean and smudge filters.

In the .gitattributes file, you can set a filter for particular paths and then set up scripts that will process files just before they’re checked out (“smudge”, see Figure below) and just before they’re staged (“clean”, see Figure 8-3).

These filters can be set to do all sorts of fun things.

enter image description here

关于javascript - 美化 github 上 pull 请求之前/之后的所有文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38697406/

相关文章:

node.js - 如何使用 TypeScript 在 Electron 中使用 remote.require()

node.js - 如何使用node.js在mongoDB中通过_Id查找

javascript - 如何使用相同的现有数据创建新的div?

javascript - Vue.JS。通过路由器传递 prop

javascript - 如何用cheerio获取数据?当我在页面源数据中看到为空时,但是当我在检查元素中看到时,我看到了数据

git - 发现可疑 https ://github. com/Homebrew/brew git origin remote

git - git 分支名称的最大长度

javascript - 无法使用 JavaScript 访问自定义 HTML 标记内的 DOM 元素

javascript - BrowserRouter 与服务器有什么关系?

xcode - 在现有的 Xcode 项目中使用 Git