Git with Eclipse (EGit) - Tutorial
Lars Vogel
Version 2.7
Copyright © 2009, 2010, 2011 Lars Vogel
09.11.2011
Revision History
Revision 0.1 11.12.2009 Lars Vogel
Created
Revision 0.2 - 2.7 12.12.2009 - 09.11.2011 Lars Vogel
bug fixes and enhancements
Git with Eclipse (EGit)
This tutorial describes the usage of EGit; an Eclipse plugin to use the distributed version control system Git. This tutorial is based on Eclipse 3.7 (Indigo).
Table of Contents
1. Overview
2. EGit Installation
3. Prerequisites for this tutorial
4. Putting projects under version control
4.1. Put a new project under version control
4.2. Clone existing project
4.3. Repository view
5. Using EGit
5.1. Basic operations
5.2. Merge
5.3. View the resource history
6. Create a Git repository for multiple projects
7. Using EGit with Github
7.1. Github
7.2. Create Repository in Github
7.3. Push project to Github
7.4. Clone repository from Github
7.5. Mylyn integration with Github
8. Hacking EGit - Getting the source code
9. Thank you
10. Questions and Discussion
11. Links and Literature
11.1. EGit and Git Resources
11.2. vogella Resources
1. Overview
Git is a distributed version control system written in C. JGit is a library which implements the Git functionality in Java. EGit is an Eclipse Team provider for Git (using JGit) and makes Git available in the Eclipse IDE.
This tutorial describes the usage of EGit. If you want to learn about the usage of the Git command line you can use the Git Tutorial as a reference.
2. EGit Installation
Eclipse 3.7 contains EGit in its default configuration. So typically you do not need to install anything.
If you use an older version of Eclipse you can use the Eclipse Update manager to install the EGit plugin from http://download.eclipse.org/egit/updates. The latest features can be found in the nightly build but this build is not as stable as the official update site target http://download.eclipse.org/egit/updates-nightly .
3. Prerequisites for this tutorial
This article assumes what you have basic understanding of development for the Eclipse platform. Please see Eclipse RCP Tutorial or Eclipse Plugin Tutorial .
4. Putting projects under version control
The following section explains how to create a repository for one project and shows how to checkout an exiting projects from a remote repository.
4.1. Put a new project under version control
Create a new Java project "de.vogella.git.first" in Eclipse. Create the following class.
package de.vogella.git.first;
public class GitTest {
public static void main(String[] args) {
System.out.println("Git is fun");
}
}
Right click your project, select Team -> Share Project -> Git. Select the proposed line and press "Create repository". Press finish.
You have created a local Git repository. The git repository is in this case directly stored in the project in a ".git" folder.
Create the file ".gitignore" in your project with the following content. All files / directories which apply to the pattern described in this file will be ignored by git. In this example all files in the "bin" directory will be ignored.
bin
4.2. Clone existing project
EGit allows to clone an existing project. We will use an Eclipse plugin as example. To learn more about accessing standard Eclipse coding please see Eclipse Source Code Guide.
Select File -> Import -> Git -> Git Repository. Press clone and maintain the git repository "git://dev.eclipse.org/org.eclipse.jface/org.eclipse.jface.snippets.git". You only have to paste the URL to the first line of the dialog, the rest will be filled out automatically.
After pressing next the system will allow you to import the existing branches. You should select at least "master".
The next dialog allow you to specify where the project should be copied to and which branch should be initially selected.
You get an additional import dialog.
You have checked to the project and can use the team Git operation on your project.
4.3. Repository view
EGit has a "Git repository"" view which allow you to browse your repositories, checkout projects and manage your branches.
5. Using EGit
5.1. Basic operations
Once you have placed a project under version control you can start using team operations on your project. The team operations are available via right mouse click on your project. You can:
Select "Team" -> "Add", on the project node to add all files to version control.
Select "Team" -> "Commit", to commit your changes to the local Git repository.
Select "Team" -> "Branch" to create and to switch between branches.
Select "Team" -> "Push" to push your change to a remote Git repository (see the GitHub chapter).
"Team" -> "Tag" allows you to create and manage tags.
5.2. Merge
EGit supports currently fast-forward merge. Fast-forward merge allows to add the changes of one branch into another if this branch has not been changed. Select "Team" -> "Merge" to perform this operation.
5.3. View the resource history
Select a resource and select Show in (Alt+Shift+W) -> History to see the commit history of this resource.
6. Create a Git repository for multiple projects
To put several plugins into the same git repository you should create them in a subfolder under your workspace and then create via EGit a repository for this subfolder.
To test this create two new Java projects "de.vogella.egit.multi.java1" and "de.vogella.egit.multi.java2". Do not use the default location (which would be the workspace) but in a subfolder "gitmulti".
Create a few classes, as git is not able to save empty folders. Now select both projects, right click on them, select Team-> Share-> Git.
Done. Both projects are now in the same git repository.
7. Using EGit with Github
7.1. Github
Github is a popular hosting provider for Git projects and if you repository is public to everyone Github hosting is free. To use GitHub create an account on the Github Website. During the sign-up you will be asked to provide a "passphase". This "passphase" is later needed to push to Github from your local repository.
7.2. Create Repository in Github
Create a new repository on Github, e.g. "de.vogella.git.github".
After creation of your new repository Github tells you what to do if you would inport via the command line. As we are going to use EGit we can ignore this information.
7.3. Push project to Github
Create a new project "de.vogella.git.github" and put it under version control. Right-mouse click on your project and select "Team" -> "Push". A dialog pops up. Maintain the following data. Adjust the hightlighted line so that you are using your user and your project name.
git+ssh://git@github.com/vogella/de.vogella.git.github
Maintain your passphase which you maintained during the Github setup.
Select your branch (you should currently only have master if you followed my tutorial), press "Add all branches spec" and select next.
Press finish.
If you now select your github Dashboard and then your project you should see the commited files.
7.4. Clone repository from Github
Use the same URI you use to push to Github to clone the project into another workspace.
7.5. Mylyn integration with Github
Eclipse Mylyn is a productively tool for programmers. There is a GitHub connector for Mylyn available, please see http://wiki.eclipse.org/EGit/GitHub/UserGuide for details. .
8. Hacking EGit - Getting the source code
EGit is self-hosted on git://egit.eclipse.org. You can clone the EGit code from the repository using EGit using the following URL git://egit.eclipse.org/jgit.git and git://egit.eclipse.org/egit.git.
You also need some libraries from Orbit. See Libraries from Orbit for getting these libraries.
9. Thank you
Please help me to support this article:
Flattr this
10. Questions and Discussion
Before posting questions, please see the vogella FAQ. If you have questions or find an error in this article please use the www.vogella.de Google Group. I have created a short list how to create good questions which might also help you.
11. Links and Literature
11.1. EGit and Git Resources
http://www.vogella.de/articles/Eclipse/article.html EGit IDE Tutorial
http://wiki.eclipse.org/EGit/User_Guide EGit User Guide
http://wiki.eclipse.org/EGit/Contributor_Guide EGit contributor guide
Git Tutorial
11.2. vogella Resources
Eclipse RCP Training (German) Eclipse RCP Training with Lars Vogel
Android Tutorial Introduction to Android Programming
GWT Tutorial Program in Java and compile to JavaScript and HTML
Eclipse RCP Tutorial Create native applications in Java
JUnit Tutorial Test your application
Git Tutorial Put everything you have under distributed version control system
分享到:
相关推荐
【Egit教程:在Eclipse中使用Git进行版本控制】 Egit是Eclipse IDE中的一个插件,它为开发者提供了一种在Eclipse环境中直接使用Git版本控制系统的方式。本教程将详细讲解如何在Eclipse中配置和使用Egit,以便于进行...
http://loianegroner.com/2009/11/tutorial-using-the-egit-eclipse-plugin-with-github/ http://github.com/guides/using-the-egit-eclipse-plugin-with-github http://www.vogella.de/articles/EGit/article.html ...
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
ACM动态规划模板-区间修改线段树问题模板
# 踏入C语言的奇妙编程世界 在编程的广阔宇宙中,C语言宛如一颗璀璨恒星,以其独特魅力与强大功能,始终占据着不可替代的地位。无论你是编程小白,还是有一定基础想进一步提升的开发者,C语言都值得深入探索。 C语言的高效性与可移植性令人瞩目。它能直接操控硬件,执行速度快,是系统软件、嵌入式开发的首选。同时,代码可在不同操作系统和硬件平台间轻松移植,极大节省开发成本。 学习C语言,能让你深入理解计算机底层原理,培养逻辑思维和问题解决能力。掌握C语言后,再学习其他编程语言也会事半功倍。 现在,让我们一起开启C语言学习之旅。这里有丰富教程、实用案例、详细代码解析,助你逐步掌握C语言核心知识和编程技巧。别再犹豫,加入我们,在C语言的海洋中尽情遨游,挖掘无限可能,为未来的编程之路打下坚实基础!
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
本项目为Python语言开发的PersonRelationKnowledgeGraph设计源码,总计包含49个文件,涵盖19个.pyc字节码文件、12个.py源代码文件、8个.txt文本文件、3个.xml配置文件、3个.png图片文件、2个.md标记文件、1个.iml项目配置文件、1个.cfg配置文件。该源码库旨在构建一个用于表示和查询人物关系的知识图谱系统。
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
rtsp实时预览接口URL:/evo-apigw/admin/API/MTS/Video/StartVideo HLS、FLV、RTMP实时预览接口方式 :接口URL/evo-apigw/admin/API/video/stream/realtime 参数名 必选 类型 说明 data true string Json串 +channelId true string 视频通道编码 +streamType true string 码流类型:1=主码流, 2=辅码流,3=辅码流2 +type true string 协议类型:hls,hlss,flv,flvs,ws_flv,wss_flv,rtmp hls:http协议,m3u8格式,端口7086; hlss:https协议,m3u8格式,端口是7096; flv:http协议,flv格式,端口7886; flvs:https协议,flv格式,端口是7896; ws_flv:ws协议,flv格式,端口是7886; wss_flv:wss协议,flv格式,端口是7896; rtmp:rtmp协议,端口是1975;
Simulink永磁风机飞轮储能系统二次调频技术研究:频率特性分析与参数优化,Simulink永磁风机飞轮储能二次调频技术:系统频率特性详解及参数优化研究参考详实文献及两区域系统应用,simulink永磁风机飞轮储能二次调频,系统频率特性如下,可改变调频参数改善频率。 参考文献详细,两区域系统二次调频。 ,核心关键词: 1. Simulink 2. 永磁风机 3. 飞轮储能 4. 二次调频 5. 系统频率特性 6. 调频参数 7. 改善频率 8. 参考文献 9. 两区域系统 以上关键词用分号(;)分隔,结果为:Simulink;永磁风机;飞轮储能;二次调频;系统频率特性;调频参数;改善频率;参考文献;两区域系统。,基于Simulink的永磁风机与飞轮储能系统二次调频研究:频率特性及调频参数优化
MATLAB驱动的ASR防滑转模型:PID与对照控制算法对比,冰雪路面条件下滑移率与车速轮速对照展示,MATLAB驱动的ASR防滑转模型:PID与对照控制算法对比,冰雪路面条件下滑移率与车速轮速对照图展示,MATLAB驱动防滑转模型ASR模型 ASR模型驱动防滑转模型 ?牵引力控制系统模型 选择PID控制算法以及对照控制算法,共两种控制算法,可进行选择。 选择冰路面以及雪路面,共两种路面条件,可进行选择。 控制目标为滑移率0.2,出图显示车速以及轮速对照,出图显示车辆轮胎滑移率。 模型简单,仅供参考。 ,MATLAB; ASR模型; 防滑转模型; 牵引力控制系统模型; PID控制算法; 对照控制算法; 冰路面; 雪路面; 控制目标; 滑移率; 车速; 轮速。,MATLAB驱动的ASR模型:PID与对照算法在冰雪路面的滑移率控制研究
芯片失效分析方法介绍 -深入解析芯片故障原因及预防措施.pptx
4131_127989170.html
内容概要:本文提供了一个全面的PostgreSQL自动化部署解决方案,涵盖智能环境适应、多平台支持、内存与性能优化以及安全性加强等重要方面。首先介绍了脚本的功能及其调用方法,随后详细阐述了操作系统和依赖软件包的准备过程、配置项的自动生成机制,还包括对实例的安全性和监控功能的强化措施。部署指南给出了具体的命令操作指导,便于新手理解和执行。最后强调了该工具对于不同硬件条件和服务需求的有效应对能力,特别是针对云计算环境下应用的支持特点。 适合人群:对PostgreSQL集群运维有一定基础并渴望提高效率和安全性的数据库管理员及工程师。 使用场景及目标:本脚本能够帮助企业在大规模部署时减少人工介入时间,确保系统的稳定性与高性能,适用于各类需要稳定可靠的数据库解决方案的企业或机构,特别是在大数据量和高并发事务处理场合。 其他说明:文中还提及了一些高级功能如自动备份、流复制等设置步骤,使得该方案不仅可以快速上线而且能满足后续维护和发展阶段的要求。同时提到的技术性能数据也为用户评估其能否满足业务需求提供了直观参考。
房地产开发合同[示范文本].doc
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
工程技术承包合同[示范文本].doc
蓝桥杯开发赛【作品源码】