Github

Troy Scott

beans & bits


EGit-Developing Solutions in Eclipse

16 Jun 2013

Previous posts have walked through adding EGit to Eclipse, creating a repository on Github, cloning the repository and making the first commit.      This is enough to get you started but once you start coding the process is a little more involved than this.  Obviously new files and edits to existing files will constantly change the state of the project.  In most cases you will want to commit these changes to the git repository and then finally “push” them to a remote server like Github.  With Git the developing cycle may go something this:

  • add a new files
  • edit a file
  • stage the new file
  • commit the new file
  • stage the edited file
  • commit the edited file
  • Push to the remote server (optional)

After adding the new file (.gitignore)  and editing 1 file (views.py) this is what the Git Repository Explorer will look like:

There are 3 key sections in the Git Repository Explorer

  1. Unstaged Changes
  2. Staged Changes
  3. Commit Message

We are going to make 2 separate commits.  In order to do this we must perform the following steps:

First Commit

  • Stage .gitignore by dragging the file from Unstaged (1) to Staged (2)
  • Provide a commit message: initial check in
  • Click the commit button

Second Commit

  • Stage views.py
  • Provide as commit message: Changed output message
  • Click the commit button

The final but “optional” step is pushing the changes to the remote repository. 

Click on the project in the Git Repository Explorer, right click and click “Push”:

You should see the following menu:

Click next. Set the Source ref and Destination ref to master [branch] and then click Add Spec and click the check box marked “Save specifications in origin configuration”.

Click “Finish” and you should see output similar to this:






comments powered by Disqus