Git History
EGit leverages the Eclipse History view to help you explore the version history of a Git repository.
The History View
To open the History view, select a Git-managed project in the Project Explorer and use the context menu command Team → Show in History.
The History view consists of three main sections:
- Version History (Top): Displays the commit history of the repository.
- File List (Bottom Right): Shows files associated with the selected commit.
- Commit Details (Bottom Left): Provides details about the selected commit.
To investigate a specific commit, select it in the version history and view the details using the File List and Commit Details sections.
To examine changes for a particular file in the selected commit, use the Compare commands in the context menu.
- Compare With Previous Version: Compares the selected file with its previous version. This performs a file-by-file comparison.
- Compare With Working Tree: Compares the selected file with its current version in the Git working tree (i.e., the version in your Model RealTime workspace). A dialog will appear to let you choose how to perform the comparison:
- **File-by-file compare:** Compares only the selected file.
- **Logical model compare:** Compares all files within the same logical model (e.g., one .emx file and zero to many .efx files).
- **Closure compare (all workspace):** Compares all files in the workspace.
For more information on comparison types, refer to the document Comparing and Merging Models.
Filtering the History View
The Git History view offers several tools for filtering commit history, allowing you to focus on specific changes or navigate through the repository more effectively.
- Refresh: Click this button to update the history view and reflect any new changes made to the repository since the last refresh.
- Link with Editor and Selection: This option synchronizes the history view with your current editor session, enabling you to navigate directly between commits and their corresponding code changes.
- Pin this History View: Pin the history panel to the side of your screen to keep it visible as you work, making it easier to reference past commits.
- Show Repository Menu Button: Access additional repository management options, including switching between repositories, creating new repositories, and managing repository settings.
- Compare Mode: Enable compare mode to visually compare differences between selected commits, making it easier to spot changes.
- Change Which Commits to Show: Configure the view to display all commits or filter by specific branches, tags, or other criteria. This helps you focus on the relevant parts of the commit history.
- Show First Parent Only: Simplify the history view by displaying only the first parent of each merge commit, which is particularly useful for complex merge scenarios.
- More Button: Access additional customization options such as:
- Refresh: Update the history view to reflect the latest repository state.
- Columns: Customize the columns shown in the history view, allowing you to display only the information you need.
- Show: Choose which elements of the history view (e.g., commit details) are visible, tailoring the view to your preferences.
- Filter: Apply specific filters to narrow down the commit history further, such as filtering by commit author or message.
- Ref Filters: Adjust reference filters to control which references (branches, tags, etc.) are included in the history view.
- Compare Mode: Toggle compare mode on or off as needed for commit comparison.
- Reuse Compare Editor: Reuse the same comparison editor for multiple comparisons, reducing clutter when comparing commits.
Searching the History View
The search features in the Git History view allow you to explore the commit history more deeply and customize how the history is displayed.
- Show/Hide Find Toolbar: Activate the search by clicking the "Show Find Toolbar" button. Type a term in the input box to highlight matching commits. Use Next/Previous buttons to navigate through matches. Customize search settings with the adjacent menu to select specific columns or toggle case sensitivity.
- Go to Previous/Next Commit Matching Search Criteria: These buttons allow you to jump to the previous or next commit that matches your current search criteria, making it easier to find relevant changes.
- Change to All Menu Button: Toggle between viewing the entire commit history or only the commits that match your applied filters, helping you narrow down the history.
- Switch Repository Menu Button: Quickly change between different repositories without leaving the history view, making it easier to work across multiple projects.
- Change File Scope for History: Focus the history view on a specific file or directory, narrowing the scope of commits displayed to just those affecting the selected file(s).
Comparing from History View – Git Tree Compare View
If you select two commits in the History view, you can use the "Compare with Each Other in Tree" command from the context menu.
This opens the Git Tree Compare View, showing differences between the selected commits in terms of added, removed, or modified files or directories.
To initiate a file comparison, click the "Compare mode" button in the toolbar:
Then, double-click a file to start a file-by-file comparison.
If you select only one commit and use the "Compare with Workspace" command, the Git Tree Compare View will show differences between the selected commit and your current workspace.
In this case, double-clicking a file opens the "Select kind of compare" dialog, allowing you to expand the comparison to a logical model or closure compare.
Using the Git Repositories View to Investigate Branches
For a simple overview of available branches, the Git Repositories view is a useful alternative to the History view. It provides a concise summary of the branches in the repository and highlights the currently checked-out branch.
To open the Git Repositories view, right-click a Git-managed project in the Project Explorer and select Team → Show in Repositories View.
To view your local branches, expand Branches → Local.
The currently checked-out branch is marked with a checkbox and is also displayed in brackets after the project name in both this view and the Project Explorer.