Skip to main content

Eclipse GitHub Repo

Creating New Repository

  1. Launch Github Desktop
  2. File > New repository
  3. Leave Default Path alone (E:\GitHub Repo). Just type in a name then Create Repository.
  4. After you create repository the new path will be E:\Github Repo\ProjectName
  5. Quickly access the new repository by doing... Repository > Show In Explorer in Github Desktop
    1. This is where you will be copying your eclipse source folder if it already exists.
    2. This is where you should create your new Eclipse project if it is a new project.
  6. Place a .gitignore file in E:\Github Repo\ProjectName

Contents of .gitignore

5.1 Creating New Eclipse Project

image-1620189991100.png

Uncheck default location. Choose E:\GitHub Repo\The New Repo Folder. Then finish.

5.2 Importing Old Eclipse Project

In eclipse right click on the existing project. Then Show In > System Explorer.

Copy the project folder and paste it in the folder in step 4.1.

Your repository in step 5.1 should look like this now.

image-1620188747014.png
  1. File > Import > General > Projects from Folders or Archives...
  2. Locate the new project you copied in E:\Github Repo
  3. Done. Finished importing

Finally committing

If you are importing, Make sure you commit first. Then in Eclipse. Delete the old project.

Now type in a summary in the GitHub app. And an optional description of the changes. Then press Commit.

After you commit you have to Publish. in the top right.

Any future commits have to be Pushed. also in the top right (it isn't called Published).

Checking Out an Older Version

In GitHub Desktop. Click on your repo. Repository -> Open in Command prompt.

git log   // allows you to see all your commits

git checkout commitnumber here // lets you go back to an older commit
// example: git checkout 92753a2c847b035e3fa11a182a117247e5098a74

// now check for changes in eclipse.
// to go back to the main branch do
git checkout main

What if I want to copy old code. And commit some of the old code + new code onto github?

Easy... while you are checking out the older version. Copy the old code you need. Then switch back to main. And paste the old cold where it needs to be. Then commit via the Desktop App.