GIT:How to update the server with your local repository changes

Pushing when used in the context of git repositories indicates that changes are going form the source repository to the target repository or upstream server. If the changes on the remote server are not compatible. Git can merge simple changes like two different edits to a file in different locations. This process is called a merge. The merge is at the syntax level. It could break the code. This is another reason why tests are critical. If git is unable to automatically merge changes it will not allow the commit and ask you to resolve the differences. Eclipse Git (EGit) provides a Commit and a Push menu option to facilitate pushing  your changes to the server so that others can pull them. In most cases merges are rare. A merge is not bad, in fact later we will discuss and use merge to promote changes along the Continuous Integration process.

Start Eclipse. Go to bank and open the file by double clicking  on it. You should see something very similar to the screen snap below. Put in a comment in One syntax for comments requires a // at the start of the line  That is the syntax we will use.  I used a different syntax. The asterisk by the name of the file in the tab in the editor means that the file is  modified.



We will skip running of the tests  to verify that the change did not break anything. Running of the tests was previously covered. If you choose to run the tests you will be prompted to save the file. You can navigate back to this spot and continue with the steps below.

If you run the tests you will see the following. The change you made has not been written to the disk so the two instances must be resolved. Click Yes


Right click on the file to select just this file for commit inclusion. If you clicked on the project all of the files under project would have been considered and most likely you would end up with one file.

To commit changes to the remote server we use Team > Commit as shown below.  Click Commit.


If you did not run the tests you will see the following. The change you made has not been written to the disk so the two instances must be resolved. Click Yes


Verify that the file listed in the Files area is  …/  This will update your local history and then update the server. The default for this dialog varies on Windows and Mac versions of Eclipse. We want to perform a Commit and Push. Enter a short description about the change and then click Commit and Push.


You may see a dialog box indicating that Eclipse is communicating to the server. Very fast computers on very fast networks will just see a flash of the screen.  You should see a dialog similar to the one below but not 100% identical.  This dialog is informational. The results has already been pushed at this point. Each commit has a unique number so don’t try to match the dialog below up with your dialog boxes.  Click OK and you are done.  The > symbol that was on your file, directory or project should be removed.commit Push screen

There is no need to run the tests in this case.


Leave a Reply

Your email address will not be published. Required fields are marked *