使用 IDE 进行 git 编码

发布于 2024-10-18 12:13:45 字数 234 浏览 2 评论 0原文

我是 Git 新手。在使用 Git 之前,我在我的 Web 项目中使用了 Subversion。我想知道的一件事是使用 GIT 时如何在 IDE 上编码。对于 SVN,只有一个版本的代码本地存储在您的计算机上,因此我们只需在将其提交到远程存储库之前直接打开并编辑该版本即可。然而,对于 Git,我们在本地存储了多个修订版本,因此我不知道如何使用 IDE 进行工作。 IDE 必须支持 Git 吗?目前,我只能使用终端中的集成编辑器进行编码,这不是很方便。

I'm new to Git. Before using Git, I used Subversion for my web project. One thing I'm wondering is how to code on an IDE when working with GIT. As for SVN, only one version of code is locally stored on your computer so we just have to open and edit that version directly before committing it to the remote repo. However for Git, we have multiples revisions stored locally so I don't know how to work using an IDE. Must the IDE support Git? Currently, I'm only managing to code using an integrated editor in Terminal which is not very convenient.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

静赏你的温柔 2024-10-25 12:13:45

我不明白 IDE 有何相关性。您只需像往常一样随时提交,然后当您想要推送到远程存储库时,就可以这样做。

当然,如果 IDE 支持 Git,那就太好了,因为这样您就不需要在控制台和 IDE 之间切换,但它肯定不需要这样做。 IDE 应忽略 Git 的存储库,就像它必须忽略 Subversion 的 .svn 目录一样。

当然,使用 Visual Studio - 即使没有任何插件 - 也没有给我带来任何与 Git 相关的问题。

I don't understand how the IDE is relevant. You just commit whenever you want as normal, and then when you want to push to a remote repository, you do so.

It's a bonus if the IDE supports Git of course, as then you don't need to switch between a console and the IDE, but it certainly doesn't have to. The IDE should ignore Git's repository just as it would have to ignore the .svn directories for Subversion.

Certainly working with Visual Studio - even without any plugins - has given me no Git-related problems.

记忆で 2024-10-25 12:13:45

许多主要 IDE 都对 Git 提供一定的支持。它通常来自插件,而不是来自 IDE 的核心功能。

至少,IDE 的 git 集成应该允许您提交并推送到远程存储库。它也可能适用于早期提交等。您的效果可能会有所不同,具体取决于您选择的语言、您使用的 IDE 以及您的平台。所有这些都只是系统命令的包装,所以没有什么是你不能做的,它可能只是不方便。

我同意 Jon 的观点——IDE 无关紧要。你只要正常工作就可以了。如果您将 IDE 指向正确的目录,它将显示代码并让您对其进行处理。

A lot of major IDEs have some support for Git. It usually comes from a plugin, not from the core functionality of the IDE.

At the very least, the git integration of your IDE should allow you to commit and push to the remote repo. It may also work on earlier commits, etc. Your mileage may vary depending on your language of choice, what IDE you're using, and your platform. All of this is just a wrapper for system commands, so there's nothing that you won't be able to do, it might just not be convenient.

I agree with Jon -- the IDE is irrelevant. You'd just work normally. If you point the IDE to the right directory, it'll show the code and let you work on it.

生死何惧 2024-10-25 12:13:45

使用 git,您拥有通常将更改提交到的主分支。与 SVN 没有区别,因为在 SVN 中您通常提交到主干。如果您正在使用分支,您将使用 SVN 或 Git 更改到分支并在那里进行提交。就是这样。在此用例中,Git 和 SVN 之间的区别之一是您在使用 Git 时拥有可用的完整历史记录。

With git you have the master branch to which you usually commit your changes. There is no difference to SVN, cause in SVN you usually commit to the trunk. If you are working with branches you will change to the branch either with SVN or with Git and do your commits there. That's it. One of the differences between Git and SVN in this use case is you have the whole history availabe while working with Git.

三寸金莲 2024-10-25 12:13:45

正如 Jon 已经提到的,包含所有版本的 .git 文件夹在 IDE 中是隐藏的。您始终会在工作目录中签出一个版本,该版本仅包含普通源代码。

我使用 Netbeans,它有一个插件支持 GIT 的一些非常基本的功能。它突出显示了与以前的版本相比已更改、添加或删除的行,这非常有用。对于分支、提交等,我使用终端。

As Jon has already mentioned, the .git folder that contains all versions is hidden from the IDE. You always have one version checked out in your work directory which just contains ordinary source code.

I work with Netbeans for which an plugin exists that supports some very basic features of GIT. It highlights lines that have been changed, added or deleted compared to the previous version, which is quite useful. For branching, commiting and so on, I use a terminal.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文