(transfer) using git in eclipse

 

 

http://blog.csdn.net/hhhccckkk/article/details/10458159

 

Some eclipse already comes with GIt, so there is no need to install it. If you want to reinstall, you can uninstall GIT first, uninstall

Different eclipse uninstalls are different:

1. Click the menu "Help"->"About Eclipse" in Eclipse. The dialog box shown in Figure 1 will pop up, click the "Installation Details" button, and the dialog box shown in Figure 2 will pop up. Select the plugin to be uninstalled (hold down Ctrl for multiple selections), and click the "Uninstall..." button.


2.Adt——about adt, as shown in the figure



Click on Installation Details

The following box will pop up, find the corresponding plugin in it and uninstall it



After selecting the plugin to be uninstalled, click Uninstall to uninstall it. ctrl+left mouse button to select multiple


1. After uninstalling, install Git, which is the same as installing a general plug-in:

》》help——Install new software


In the pop-up box, enter the git download address: http://download.eclipse.org/egit/updates/

Click ok, if there is no response, please click the small triangle in front of Add, find the item named git just created, wait for a while, this box will appear



Check the two items below the name, click next, and enter the installation. After installation, eclipse will restart and the installation is complete



Or, click help - Marketplace, enter git in it, find it, and then install it (some eclipses have this, some don't)


After installation, proceed, a simple configuration, fill in our username and email

》》Preferences》Team》Git>Configuration



Click Add Entry, enter the value key of key and value in the pop-up box
, fill in the name: user.name, value is your name.
Email: user.email value: your email account. When you submit the code, this information will be automatically extracted and sent to the git remote repository together with the code


2. (1) Submit the project to the remote git repository for the first time. (I use github as an example, github is easy to use, you can upload your own projects, you can clone the code anytime and anywhere for development, or you can use it as a network disk)

Go to github, register an account, log in


Click New repository, enter the project name and project introduction as required, select public, private, and charge. Click Create and that's it. Name, don't use Chinese. As shown in the figure below, click Http, copy https, for a while, submit the project with




(2) Create a project and a local git repository

Open eclipse, create a project casually, and then

In turn: File > Team > Share Project Select GIT > next


Tick ​​the picture, click the items listed below, then click Create Respository below, and finally, finish,
the local repository is created


(3) Submit the code to the local repository (the code needs to be submitted to the local repository before it can be submitted to the remote git repository)

First, you need to submit the code to the local warehouse:
in turn: right click on the project > team > commit


Enter a comment, and then check the files you need to submit, or the small tick on the right, click Select All.

Then, Commit, submit it to the local warehouse (Commit and Push some git have this, some don't, using it can directly submit the code to the local and submit it to the remote git together).


(4) Push the project to the remote warehouse:

   Right click on the project>>team>remote>>push


输入Url:在githob上面,创建项目获取到的,复制进去。填上自己登陆githob的账号密码,next



点击小三角,点选master,Add spec》。finish

完成后,登陆githob,可以看见刚提交上去的项目 了



(5)把远程仓库的项目,克隆到eclipse里面

    把ecpilse切换到git视图
    点击Clone Git repository


或者,点击上图:有个箭头那个。

在里面填入,你需要克隆的项目的url地址:输入账号和密码


 



>>next>>next


点击Browse,选择一个地方放项目文件。不要放在eclipse工作目录

finish


完成后,用import导入项目到eclipse


和导入一般工程一样的了


(5)提交一次代码到git仓库

提交代码和上面提交整个项目到git是一样的了,首先,commit,把你需要提交的代码,提交到本地,然后,remote,push,提交项目到远程。


其他,点击项目,右键,还可以创建分支,分支也可以提交上去,但是,他不会和主代码和在一起。使用merge,可以进行合并。

 


 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326946486&siteId=291194637