git 如何将 Sublime Text 与 GitHub 集成?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23716909/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 18:05:30  来源:igfitidea点击:

How to integrate Sublime Text with GitHub?

gitgithubsublimetextsublimetext3sublime-text-plugin

提问by van_folmert

I thought it would be perfect if ST would have a plugin for syncing repo with the one on GitHub account, but I can't find such a thing.

我认为如果 ST 有一个插件可以将 repo 与 GitHub 帐户上的插件同步,那将是完美的,但我找不到这样的东西。

There is Github Tools and sublime-github but they don't provide commitor pushcommands.

有 Github 工具和 sublime-github,但它们不提供commitpush命令。

I can always use GitHub's app for syncing but plugin is more convenient, since it can be assigned to ST's hotkeys.

我总是可以使用 GitHub 的应用程序进行同步,但插件更方便,因为它可以分配给 ST 的热键。

回答by MattDMo

There are numerous gitpluginsavailable via Package Control, so all you have to do is browse through them, read the READMEs, and decide if you want to try it out. I use SideBarGit(along with SideBarEnhancements), which allows you to right-click on a file in your project and get access to the whole array of git-related tasks, from Add & Commit & Pushto Branchto Cloneto Diffand more. Another popular tool is Git, which provides essentially the same options as SideBarGit, just in a menu off Toolsinstead.

许多git插件可以通过Package Control 获得,因此您所要做的就是浏览它们,阅读自述文件,然后决定是否要尝试一下。我使用SideBarGit(连同SideBarEnhancements),它允许您右键单击项目中的文件并访问整个git相关任务数组,从Add & Commit & PushBranchCloneDiff等等。另一个流行的工具是Git,它提供与 基本相同的选项SideBarGit,只是在菜单中关闭Tools

SublimeGitis a free-to-try, 10 to buy commercial plugin (available through Package Control) that looks like it's very full-featured, allowing you to do just about anything related to git. It includes a number of syntax definitions for editing commit messages, looking at diffs, comparing branches, etc., and judging by its popularity (it's one of the Top 100 at Package Control) a lot of people seem to like it. But, it's not open-source, and costs extra money to use long-term.

SublimeGit是一个免费试用、10 次购买的商业插件(可通过 Package Control 获得),看起来功能非常齐全,允许您执行与 git 相关的任何事情。它包括许多用于编辑提交消息、查看差异、比较分支等的语法定义,并且根据它的受欢迎程度(它是包控制的前 100 名之一)来判断很多人似乎喜欢它。但是,它不是开源的,长期使用需要额外花钱。

Any of these will work with Github, Bitbucket, or any other public or private repo that uses the gitprotocol. Try them out, and see what works for you.

其中任何一个都可以与 Github、Bitbucket 或任何其他使用该git协议的公共或私有存储库一起使用。试试看,看看什么对你有用。

回答by callmebob

13 March 2019 - SublimeMerge was released

2019 年 3 月 13 日 - SublimeMerge 发布

You can use SublimeMerge, which was created by the same people, who wrote SublimeText - so you can expect compatibility and updates as long as SublimeText is as popular as it is.

您可以使用SublimeMerge,它是由编写 SublimeText 的同一个人创建的 - 因此,只要 SublimeText 如此受欢迎,您就可以期待兼容性和更新。

SublimeText version 3.2 has GitIntegration as a new feature. Here is some details from changelog:

SublimeText 3.2 版将 GitIntegration 作为一项新功能。以下是更改日志中的一些详细信息:

  • Files and folders in the sidebar will now display badges to indicate Git status
  • Ignored files and folders are visually de-emphasized
  • The current Git branch and number of modifications is displayed in the status bar
  • Commands have been added to open a repository, see file or folder history, or blame a file in Sublime Merge
  • Themes may customize the display of sidebar badges and status bar information
  • The setting show_git_status allows disabling Git integration
  • All file reads are done through a custom, high-performance Git library written for Sublime Merge
  • Read the documentation
  • 边栏中的文件和文件夹现在将显示徽章以指示 Git 状态
  • 忽略的文件和文件夹在视觉上不再强调
  • 状态栏显示当前Git分支和修改次数
  • 添加了用于打开存储库、查看文件或文件夹历史记录或在 Sublime Merge 中归咎于文件的命令
  • 主题可以自定义侧边栏徽章和状态栏信息的显示
  • 设置 show_git_status 允许禁用 Git 集成
  • 所有文件读取都是通过为 Sublime Merge 编写的自定义高性能 Git 库完成的
  • 阅读文档

回答by Boyanov

Via Package Control, you can install sublime-github. It's simple and works fine for me.

通过Package Control,您可以安装sublime-github。这很简单,对我来说很好用。

回答by Moh .S

All you need are the extensions 'Git', 'Git Gutter', and 'Sublimerge'

您只需要扩展“ Git”、“ Git Gutter”和“ Sublimerge

Git:I use it to open git gui and perform all the other git operations right inside Sublime Text.

Git:我用它来打开 git gui 并在 Sublime Text 中执行所有其他的 git 操作。

Git GutterI use this to display the new changes that are not committed yet on the current working file.

Git Gutter我用它来显示当前工作文件中尚未提交的新更改。

SublimergeI use this to compare the current working file with any previous revisions of the same file

Sublimerge我用它来比较当前工作文件与同一文件的任何先前修订版

回答by VonC

In addition to using Sublime Merge, mentioned above, you can invoke it directly with git difftoolnow.

除了使用崇高合并上面提到的,你可以直接调用它git difftool现在。

With Git 2.22 (Q2 2019), that will be easier, since the configuration will be done for you, and "git mergetool" learned to offer Sublime Merge (smerge) as one of its backends.

使用 Git 2.22(2019 年第二季度),这会更容易,因为配置会为您完成,并且“ git mergetool”学会了提供 Sublime Merge ( smerge) 作为其后端之一。

As commented in SublimeTextIssues/Merge issue 19:

正如SublimeTextIssues/Merge 问题 19 中所述

Usage:

用法:

git config --global merge.tool smerge 

and then just git mergetoolor git difftool.

然后只是git mergetoolgit difftool

See commit f57b2ae, commit eb12adc(04 Apr 2019) by David Aguilar (davvid).
(Merged by Junio C Hamano -- gitster--in commit 5116eab, 22 Apr 2019)

请参阅David Aguilar ( )提交的 f57b2aeeb12adc(2019 年 4 月 4 日)(由Junio C Hamano合并-- --commit 5116eab,2019 年 4 月 22 日)davvid
gitster

mergetools: add support for smerge(Sublime Merge)

Teach difftooland mergetoolabout the Sublime Merge "smerge" command.

mergetools: 添加对smerge(Sublime Merge) 的支持

教导difftoolmergetool了解 Sublime Merge " smerge" 命令。

Git now has a mergetools/smergefile with:

Git 现在有一个mergetools/smerge文件:

diff_cmd () {
    "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
}

merge_cmd () {
    if $base_present
    then
        "$merge_tool_path" mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
    else
        "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
    fi
}
diff_cmd () {
    "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
}

merge_cmd () {
    if $base_present
    then
        "$merge_tool_path" mergetool "$BASE" "$LOCAL" "$REMOTE" -o "$MERGED"
    else
        "$merge_tool_path" mergetool "$LOCAL" "$REMOTE" -o "$MERGED"
    fi
}

Again: the configuration is done for you.

再次:配置已为您完成。