mcfly soft
mcfly soft

Reputation: 11651

Adding a File or Folder to a Git Repo in Eclipse

I want simply add a new File or Folder to an existing Repo in my Eclipse.

I tried the following (add index on the file and folder), but nothing happens.

Can someone help me.

enter image description here

Upvotes: 3

Views: 7757

Answers (2)

howlger
howlger

Reputation: 34137

In Git, a new file must first be added to the index (also called staging area) and then committed before the file becomes part of the history:

  1. Add files:
    • Right-click and choose Team > Add to Index or
    • in the Git Staging view move the file from Unstaged Changes down to Staged Changes
  2. Commit files: In the Git Staging view enter a Commit Message and click Commit

Result: In the History view a new commit containing the files is shown.

Please note in Git (in contrast to e.g. SVN) only files, but not empty folders can be committed.

Upvotes: 3

VonC
VonC

Reputation: 1323183

Check the properties on that folder to get its path.

Switch to command line, and do a git status (if you have Git installed), to check if the folder and its content is actually in a Git repo (or if only "src" is):
Chec at least if you see a .git folder above the folder you want to add to the index, you should be able to do so from Eclipse.
But if not, that would explain why adding it does nothing.

Upvotes: 0

Related Questions