How To Merge Code In Eclipse
Solution 1:
Within Eclipse, start using the Git Repository Explorer perspective, and the Git Staging View.
The repository explorer shows your clone, allowing you to see your branches, your change history etc. You can right mouse on your clone's name and choose pull. This will fetch changes from the Bitbucket server and then merge them to your local branch.
Note you should not pull until you have either stashed any locally modified files, or have committed them to your branch. If the pull conflicts with any local changes the action will be rejected.
As you are sharing a branch with other people you should consider modifying your local (master?) branch via Configure Branch... to enable the Rebase option. This means when you merge remote changes over your local branch, any outgoing commits are replayed over the top of the incoming ones. It means when you push you avoid merge points which can clutter up the history. Encourage other people working in their own repos to do likewise.
Secondly, when you are committing changes, learn to use the Git Staging view. This makes it easy to drag and drop changes and commit them in a single go. You can also do this from Team | Add and Team | Commit... but IMO this is far more clumsy.
When you are ready for others to see your committed changes you must push them. Normally you would either right mouse on a project and choose Team | Push to upstream or go to the repository explorer, right mouse on the clone and choose Push to Upstream. If necessary you may have to pull before you can push because the server will reject changes if they do not satisfy merge
This is the basic workflow of using Git within Eclipse. As a general point, also ensure your version of the EGit plugin is at least 2.3.1 or 3.0.1 depending on your version of Eclipse.
Solution 2:
you can not get the newest code that be changed by your friend is maybe because after he changed but he didn't commit..and now although you cannnot get the changed code but you can also commit your changed code.because when he commit...maybe errors shows then your friends will change his code base the code you have commited.
Post a Comment for "How To Merge Code In Eclipse"