Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
student:eclipse:git [2019/12/11 16:49] – Added the section on non-fast-forward bernstdh | student:eclipse:git [2025/03/28 14:12] (current) – bernstdh | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Using Git with Eclipse ===== | ===== Using Git with Eclipse ===== | ||
- | The Eclipse plugin that integrate Git with Eclipse is called EGit. | + | The Eclipse plugin that integrate Git with Eclipse is called EGit. For more information, |
==== Installation ==== | ==== Installation ==== | ||
Line 10: | Line 10: | ||
==== Configuration ==== | ==== Configuration ==== | ||
- | To configure Git, click on < | + | To configure Git, click on < |
- | Since many Git servers use your email address for authentication, | + | Since many Git servers use your email address for authentication, |
You can edit an existing entry by clicking on it. You can add an entry by clicking on < | You can edit an existing entry by clicking on it. You can add an entry by clicking on < | ||
Line 26: | Line 26: | ||
- Open the [[ # | - Open the [[ # | ||
- | - Click on " | + | - Click on " |
Note that you should not put the repository under the directory containing the Eclipse workspace. | Note that you should not put the repository under the directory containing the Eclipse workspace. | ||
Line 32: | Line 32: | ||
==== Adding a Project to Version Control ==== | ==== Adding a Project to Version Control ==== | ||
- | A project should be added to version control only once. After that, files in the project can be added to version control individually (or in groups). | + | A project should be added to version control only once. After that, files in the project can be added to version control individually (or in groups). To add a project to version control: |
- | + | ||
- | To add a project to version control: | + | |
- [[ # | - [[ # | ||
Line 43: | Line 41: | ||
- Click on < | - Click on < | ||
- | The name of the local repository you are using for this project will now appear next to the name of the project. In additions, the icons on any directories/ | + | The name of the local repository you are using for this project will now appear next to the name of the project. In addition, the icons on any directories/ |
If you look at the project directory (outside of Eclipse) you will see that it is now empty, and if you look at the | If you look at the project directory (outside of Eclipse) you will see that it is now empty, and if you look at the | ||
Line 64: | Line 62: | ||
The easiest way to instruct Git to commit files to the local repository is: | The easiest way to instruct Git to commit files to the local repository is: | ||
- | - Open the [[ Git Perspective | + | - Open the [[ # |
- Click on the "Git Staging" | - Click on the "Git Staging" | ||
- Select the appropriate files in the " | - Select the appropriate files in the " | ||
Line 80: | Line 78: | ||
The " | The " | ||
- | You will also be asked to provide a " | + | You will also be asked to provide a " |
Line 87: | Line 85: | ||
The easiest way to clone a remote repository is to: | The easiest way to clone a remote repository is to: | ||
- | - Open the [[ # | + | - Open the [[ # |
- | - Click on "Clone a Git repository" | + | - Click on "Clone a Git repository" |
- | - Enter the " | + | - Enter the " |
- | - Enter your authentication information for the Git server | + | - Enter your authentication information for the Git server. (Because of recent security enhancements, |
- | - Select the appropriate branch (probably | + | - Select the appropriate branch (probably |
- Enter the appropriate local directory for the " | - Enter the appropriate local directory for the " | ||
At this point, you will have cloned the repository but you will not have any Eclipse projects. To import a project from the repository, while still in the Git Perspective you should: | At this point, you will have cloned the repository but you will not have any Eclipse projects. To import a project from the repository, while still in the Git Perspective you should: | ||
- | | + | - Right-click on the repository |
- | - Expand the " | + | - Select < |
- | | + | - Select on the project(s) of interest |
- | - Select < | + | |
- Click on < | - Click on < | ||
+ | Note: Some versions of Eclipse/ | ||
==== Responding to '' | ==== Responding to '' | ||
- | If you attempt to push changes that weren' | + | If you attempt to push changes that weren' |
- | === When Using a Centralized Workflow === | + | You can then choose the option to use "When pulling", |
- | When you perform a pull with the rebase option, all of your commits are moved to the tip of the master | + | When you perform a pull with the rebase option, all of your commits are moved to the tip of the main branch. This eliminates the need for a merge commit every time someone needs to synchronize with the central repository. Hence, |
- | it is preferred by most organizations that use a centralized workflow. | + | it is often preferred by organizations that use a centralized workflow. When using an alternative workflow, the team should agree on when merges and rebases will be used. Opinions differ on which is better because rebasing keeps the history flat and clean whereas merging keeps everything. |
- | |||
- | === When Using an Alternative Workflow === | ||
- | |||
- | When using an alternative workflow, the team should agree on when merges and rebases will be used. Opinions differ on which is better because rebasing keeps the history flat and clean whereas merging keeps everything. | ||
+ | ==== Icons/ | ||
+ | Egit uses a variety of different icons/ | ||
+ | [[ https:// | ||
Line 134: | Line 131: | ||
To add an entry to the '' | To add an entry to the '' | ||
+ | |||
+ | For more information, | ||
+ | |||
+ | |||
+ | ==== Troubleshooting ==== | ||
+ | |||
+ | - If you get an error related to your HttpConnection when you attempt to clone a repository, it may be because of the HTTP client you are using. To change it, open the Git Preferences dialog and change the HTTP client (e.g., from " | ||
+ | |||