当前位置: 动力学知识库 > 问答 > 编程问答 >

git coding with IDE

问题描述:

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.

网友答案:

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.

网友答案:

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.

网友答案:

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.

网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: