Are gitignore files being automatically created in my project? - eclipse

I have been trying to manage the local copy of the project I am working on using EGit.
I make a pull once there is a push from the other guys. However, there are files that show that I have uncommitted changes in my local repository, but I haven't made any change. I try to resolve these by manually identifying these changes and discover that they are from gitignore files, which I didn't create myself (the files also show errors occasionally).
Is it possible that the gitignore files are being auto-created? How can I maintain a synced local repo state? I am using Eclipse Kepler.

It is possible that the settings "Automatically ignore derived resources" triggers the generation/modification of .gitignore.
This is a consequence of bug 297674, adding that feature in EGit 2.3 (Q2 2013).
See the EGit tutorial:
You can also configure Eclipse to automatically ignore derived resources, e.g. class files via the Window → Preferences → Team → Git → Projects → Automatically ignore derived resources .. setting.

Related

How can I start a project on GitLab repo with Eclipse?

Good morning.
I just create a GitLab private repo to work in a project with some people. When I add GitLab repo to Eclipse, it says there aren't projects (and it's true). I would know how to create a project and sync with online repo so other members can see my project and codes.
I tried to start a project in git\repoName\ folder, then right-click and choose Team->Commit, but changes wouldn't save (in gitLab repo's website, it says "Repo is empty").
I tried to follow some online guides, but without success.
Sorry for bad english!
Eclipse 4.2 and newer, comes default with (E)Git installed. There is a good Eclipse git tutorial from Vogella.
Create a GitLab git repository
Log into GitLab
Create a project / git repository
Copy the https url from the project, used for cloning
Adding an GitLab git repository in Eclipse
Open the Git perspective in Eclipse
Use Clone existing Git repo, as shown in Using git repository view
Now all the git functionality from Eclipse can be used.
I assume you have a cloned repository available in Eclipse (eGit) that is empty. If not, follow the steps in the answer from Verhagen.
By now, you have a cloned repository that is marked with "[NO HEAD]", indicating that no commit has been made.
Start creating a new project by using your project type of choice; I'll use Java project for simplicity: File menu > New > Java project
in the New Java Project wizard un-tick the "Use default Workspace location" checkbox; instead, choose the directory where you cloned your empty GitLab project, and append the name of the project (this is to make Eclipse create a directory inside the repository, just in case you later want to create more projects in the same repo).
Fill in the wizard as you usually do. When you are done with the different steps, you'll have a new project, that is also marked with "[NO HEAD]"
Create some source files you want to share (e.g. HelloWorld.java)
Synchronize workspace (right click on the new project > Team > Synchronize workspace) you will see that now there are files to commit. Pay attention to those files, since some of them ( .gitignore, and maybe .classpath, .project,.settings directory... depending on how you share your projects) you'll want to add to the .gitignore.
right click on the files you want to commit, fill in the commit message and click "Commit and Push". Click Next
Since it is a new repository, you'll have to configure the Push action. I selected HEAD as source and HEAD as destination. You might want to do the same, at least for this first commit+push; later on, you might choose to add some specs for branches, etc.
The Push Confirmation will show you that the new branch master:master will be created.
Both project and repository lost the "[NO HEAD]" marking
You can check gitlab site to confirm your files are there.

How do I configure Eclipse to use an existing git repository with existing source code?

I have Eclipse Juno with EGit and a project that I've been working on for a while. I've decided to move it to Git, so I created a Github account and downloaded and installed the program. The repository is at C:\Users\username\GitHub\project_name\, but all it has is the README.md file.
How can I configure Eclipse to use my existing source code (in a workspace separate from the git folder) to work well with git? I've tried using Window → Show View → Other and selecting "Git Repositories," but other than adding a repository (which I have done) I can't figure out how to sync the code.
I've read this question but I get the impression that those answers will perform a one-time commit, instead of a sync.
To clarify: The repository does not have any code. I would like my existing code (in the Eclipse workspace) to be synced to the new repository.
If you already have a git repository in place, first copy all your files to that directory (yes, manually) and do a git commit -a to commit all the files into the repository. I'm assuming here that you've already initialized the repository at C:\Users\username\GitHub\project_name\ with git init.
In eclipse, go to File → Switch Workspace → Other... and point it to a workspace of your choice that can be completely different than the location of your code, or your earlier workspace. In fact, don't point it to the directory which contains your git repository.
Once you have a clean workspace, go to File → New → Other..., select Git → Git Repository and enter the path of your git repository (C:\Users\username\GitHub\project_name\). Enter a name for the repository, and click Finish.
I would really recommend you read at least the first few chapters of the git book to understand how git works, and to help you push and pull code to and from remote repositories.
If your existing repository is not git, you're going to have a hard time keeping the directories in sync. You might want to setup rsync to sync the directories. There is no way AFAIK for eclipse to automagically keep the two repositories in sync.

Configuration of Subversion in Xcode

I want to configure SVN on my computer.
For that how would I create a repository?
How to give all the paths needed?
I am using Mac os 10.7.3 Lion and Xcode 4.2.
To setup your Subversion repository in XCode 4, go to File → Source Control → Manage Repositories. Once there, you will see an option to add a repository:
After selecting Add Repository option, you will need to enter your Subversion repository URL and the name you wish to add to your repository:
Click next, and on next step you should see an option to setup paths to your folders in your svn repository. There are three folders which are usually created by default when you use svn, and they are called /trunk, /tags, /branches. In case you don't have this folders, you can skip this step, it's optional.
Now you should see in XCode organizer your repository in the sidebar. What we would like to do is add one of our projects to Subversion so we can use version control for the project. We would like to add the project to /trunk folder of our repository. In order to do this, click on the /trunk folder, and then click on the import button.
When you click import, select the folder of files which you would like to import. Then you will be prompted to enter a commit message. After this, click refresh, and you should see the new files added to your repository.
Now your project is under version control, and you should be able to see it in your Beanstalk account, in your repository. All you need to do now is checkout the files to a location of your preference, and open the project from this location.
When you open the project, you will see flags next to all files you modify, add or delete and you will see an option to commit the files.
May this Helping to you
Happy Coding.

Creating eclipse project from old project

I have an old eclipse java project which is stored in SVN. I wish to create a new one based on the old one but without the SVN files. I'll be doing some experimental changes to it and I want to have the old one as backup basically. Anyone can give advice on how to do this? Thanks
FYI: This has been posted in Javaranch as well
You have a number of options:
Don't do a check-out (which creates the metadata files, allowing for changes to be easily and later committed), but an export instead. From the "SVN Repositories" view in Eclipse, right-click the project folder, then click "Export...".
Just check-out a 2nd copy of the project from SVN, naming it with a different project name in the workspace to keep it distinct. Just refrain from checking-in any changes back to the SVN repository.
Copy the project as usual, and simply delete the SVN metadata files.
Same as #3, but let Eclipse do this for you - using Team / Disconnect.

EGit automatically add new files

When executing a commit of a set of files within the EGit eclipse plugin, I always have to add new files manually in the commit dialog
Is there a way to configure the plugin in a way, that adding new files automatically is the default setting?
Such an option exists now, it can be enabled in the preferences in Team → Git → Commit Dialog by checking Include selected untracked files:
Note that only untracked files that are contained in the selected files/folders/projects are included – so it depends on where you opened the context menu from.
Right now, there doesn't seem to be any option to have all new files added automatically.
(and this wouldn't be possible as well with Git)
Even on the commit stage, Git proposes only git commit -a -m "..." in order to automatically stage files that have been modified and deleted, but new files you have not told git about are not affected.
In other word, this would be a new feature in EGit which wouldn't have any direct correspondence in Git.