如何配置GitHub的Atom编辑器与企业级Git配合使用

3
我刚在Windows电脑上下载了GitHub的Atom编辑器,现在正在尝试将我的Atom编辑器与Git企业存储库集成,例如:
https://git.company.com/abc.git

我想克隆、修改和提交代码,应该怎么做?

你需要进行以下步骤:

2个回答

5

为了回答这个问题,我假设你已经拥有一个git仓库,并在Atom中安装了git-plusgit-clone packages

配置Git Clone

学习目标: 配置Atom编辑器和Git Clone package,将您的git仓库克隆到合适的位置。

  1. 第一步是配置Git Clone,在Atom中按下Ctrl-,打开设置。
  2. 点击左侧的Packages,找到git-clone
  3. 点击git-clone包的Settings按钮,这将打开设置页面。
  4. Target Directory设置为适合您的操作系统和设置的内容。 我强烈建议使用快速本地驱动器,例如SSD。

Screenshot of Configuring Git Clone

克隆代码库

学习目标: 使用Atom编辑器和Git Clone包将代码从中央代码库复制到您的开发机器上。

  1. First identify the appropriate git URL, I will be using a GitHub URL but this could be any git URL.

     git@github.com:RichardSlater/activate-power-mode.git
    
  2. From Atom press Ctrl-Shift-P to open up the Command Palette then type: Git Clone to select Git Clone: Clone.

  3. Enter the git URL from step one above and press Enter.

Screenshot of Clone a Repository

一旦您完成了上述三个步骤,您将拥有一个git存储库的克隆和一个新的Atom窗口已打开。
进行一些更改

学习目标: 查看如何使用Atom编辑器和Git Plus包对代码进行更改,并将其推回中央存储库。

  1. Select one of the files within the TreeView on the left hand side, in this example I am going to use lib/activate-power-mode.coffee.
  2. We're going to change the throttle limit on Line 32 from 25 to 50 - go ahead and make this change:

    @throttledSpawnParticles = throttle @spawnParticles.bind(this), 50, trailing: false
    
  3. Save this file, note that the color of the file in the TreeView has changed to Orange and the status bar will have a git status message on the right hand side:

    + 1, -1
    
  4. Now we need to add this file, open the Command Palette again by pressing Ctrl-Shift-P then typing git add, press enter to stage the current file.

  5. A green message will be displayed showing that the file was successfully added.
  6. Right lets go ahead and create a commit for this file; open the Command Palette again and type git commit, a new buffer will open where you can type a commit message. Go ahead and type a commit message.
  7. Press Ctrl+S to save the message, close the commit message buffer and create the commit.
  8. Finally push this commit to your repository by opening the Command Palette and typing git push.

现在,您应该已经通过 Atom 编辑器对您的中央 git 仓库进行了更改。

Screenshot of Change and Commit


这真的很有帮助,Richard。我看了很多材料,但没有一个能够直观地理解。 - Rajeev Nair

1

虽然 Atom 是由 GitHub 积极开发,但它并不强烈依赖于 github.com 或者托管在 GitHub 上的项目。我强烈推荐使用 git-plus,它显著地扩展了内置 Git 支持,允许进行以下操作:

  • 分支管理
  • 添加文件
  • 提交
  • 推送和拉取

Screenshot of Git Plus

据我所知,Git Plus唯一无法做到的是克隆新存储库,但是可以通过git-clone来支持克隆操作。

Screenshot of Git clone

虽然这个截图展示了GitHub的网页界面,但实际上你可以使用任何git存储库的URI。

1
实际上,我已经安装了Git-plus和git-clone包......我想知道的是如何将我的Atom阅读器连接到Git仓库,例如https://git.company.com/abc.git,以便我可以对我的仓库执行操作。 - Rajeev Nair
据我所知,我们不能在 Atom 的设置中配置以使用特定的 Git 存储库。相反,我需要使用命令并提供 Git 存储库网址,对吗? - Rajeev Nair
我现在明白你的问题了,让我发布一份详细的答案,介绍我目前如何使用Atom。 - Richard Slater

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接