- Commit
- Pushing/Pulling changes To/From the server
- Merging and Resolving Merge Conflicts
- Git Branches
- Show History
This article walks you through how to work with Git in CET Operator. Here we assume that you have created your first Git workspace and any imported data to be migrated from Perforce.
Commit
The Git Commit dialog can be accessed by:
- Clicking the Commit button in the Operator.
- Right-clicking a repo or file in the workspace and select Commit... from the menu.
- Clicking the Commit All... button in CET Developer Studio.
Inside the dialog, you can easily commit to one or more repo(s) at the same time. When selecting files from multiple repos, a commit will be made to each repo, using the same commit comment. The files you check/uncheck will be staged/unstaged when you press Save and Commit (to local repo).
The available commands in this dialog are:
Amend to Previous Commit | This option lets you add the changes of the current commit to the previous one. You can use this option if you want to add additional changes and/or change the commit comment of the previous commit. |
Push to Server | When this checkbox is checked, the changes will be automatically pushed after it has been committed. |
Change Branches Create Branch |
If you want to switch to- or create a new branch for the commit, you can select/type in the branch name here. |
Pushing/Pulling changes To/From the server
Changes can be pulled from the server by either:
- Right-clicking a repo in CET Operator and selecting Pull changes from Server in the menu. This pulls the changes only to the repo you have right-clicked.
- Clicking the Pull button in the upper-right side CET Operator. This will pull changes for all the repos in your workspace.
Changes can be pushed to the server by either:
- Right-clicking a repo in CET Operator and selecting Push Changes to Server in the menu. This pushes the changes only to the repo you have right-clicked.
- Clicking the Pull Changes From Server button in the upper-right side CET Operator. This will pull changes for all the repos in your workspace.
- When committing, by checking the Push to Server checkbox in the Git Commit dialog, as described in the previous section.
Merging and Resolving Merge Conflicts
If there are conflicts after merging or pulling changes from the server repo, the files with conflicts will show up in the file list under the repo(s) in the Operator. You can right-click files to resolve their conflict by either accepting any of the revisions, or by merging. When selecting the Merge... option, P4Merge will be used for merge, same as with Perforce.
Git Branches
In the Git Branches you see all local and remote branches in the repo. Each branch you work in will have both a local and a remote name. A local branch that you have created will get a remote branch name once you push it to the server, and a remote branch will get a local name when you check it out (switch to it) in your repo.
The Branches-dialog contains commands for:
- Switching to a branch (you can also do this by double-clicking a branch in the list).
- The checkboxes at the bottom of the dialog lets you enable options for automatically pulling changes, cleaning the workspace (including closing all running CM-processes in the workspace) or closing the dialog after switching branch.
- Pushing/Pulling changes To/From the remote branch.
- Merging from the selected branch to the current active branch (always the one on top of the list, with the green flag next to it).
- Creating a new branch.
- Creating a merge request.
Show History
You can click Show History... to examine the history of the repository.
Views
The following views are available:
Commits | See all commits on the current branch (but hide the merge-commits) |
Merges | See all merges to the current branch (show first parent only) |
Both | See all commits and merges on the current branch |
All Branches | See history of all branches |
All Local Commits | See only branches that have been locally committed. |
Sort and Filter
History can be sorted either by branch order (the default sort order in Git) or by date/time. It can also be filtered to either include or exclude commits that contain specified text.
You can use this to include or exclude commits by:
- Commit id (hash)
- Commit message
- Author
Showing Commits
Double-clicking on a commit shows it in the Git Commit dialog.
You can view the changes in each file by pressing Ctrl+D or clicking the Diff Selected button. The diff will be shown in P4Diff:
Additional Commands in the History Dialog
The right-click menu in the History dialog also lets you perform a series of actions. There are also keyboard shortcuts to help you work faster with the operator.
Show Commit... | Open the Commit-dialog showing this commit (same as double click) |
Show Commit on GitLab... | Opens a web browser showing this commit on GitLab. |
Check Out Commit... | Checks out the file revisions from this commit in your local repo. |
Revert Commit | Creates a new commit that reverts all the changes of the selected commit. |
Rollback to Before Commit | Deletes the commits made after the selected commit. Important: only use this option for commits that haven't been pushed yet. |
Check Out Branch branch name | Switches to the branch of the selected commit. |
Comments
0 comments
Please sign in to leave a comment.