Chủ Nhật, 24 tháng 3, 2013

Performing Git operations in Eclipse

10.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-click on your project or file.

The most important operations are described in the following list. Select:

  • TeamAdd to index to add the selected resource(s) to the index of Git.
  • TeamCommit, to open the commit dialog for committing to your Git repository.
  • TeamCreate Patch... to create a patch
  • TeamApply Patch.. to apply a patch to your repository
  • TeamIgnore to add the file to a .gitignore file
  • TeamShow in History to display the selection the History view.

If you select a project in Eclipse you can use additional team operations from the context menu.

  • TeamPull to pull in changes from your remote Git repository
  • TeamFetch to fetch the current state of your remote tracking branch
  • TeamSwitch To to switch or create new branches
  • TeamPush to push changes to your remote Git repository
  • TeamTag to create and manage tags.

10.2. Merge

EGit supports merging of branches to add the changes of one branch into another. Select your project and TeamMerge to start the merge dialog.

10.3. Solving Merge Conflicts

If you pull in changes or merge a branch and you have conflicting changes, EGit will highlight the affected files. EGit also supports the resolution of these merge conflicts.
Right-click on a file with merge conflicts and select TeamMerge Tool.
This opens a dialog, asking you which merge mode you would like to use. The easiest way to see the conflicting changes is to use the Use HEAD (the last local version) of conflicting files as merge mode. This way you see the original changes on the left side and the conflicting changes on the right side.


You can manually edit the text on the left side or use the Copy current change from right to left button to copy the conflicting changes from right to left.



Once you have manually merged the changes, select TeamAdd from the context menu of the resource to mark the conflicts as resolved and commit the merge resolution via TeamCommit.

10.4. Git amend

Git amend allows to adjust the last commit. For example you can change the commit message. The Git Staging view allows you to perform the Git amend command via the highlighted button in the following screenshot.


Không có nhận xét nào:

Đăng nhận xét

Học lập trình web căn bản với PHP

Bài 1: Các kiến thức căn bản Part 1:  https://jimmyvan88.blogspot.com/2012/05/can-ban-lap-trinh-web-voi-php-bai-1-cac.html Part 2:  https://...