I have a bit of an issue that I can't seem to find a solution to.
I had a project in eclipse that I was working in. I have a remote git repo in which all the source files are backed up to (but it doesn't seem to be the entire project). My project got deleted in eclipse but I had previously had a backup of the entire directory that I had zipped up and emailed to myself a while back which contains the entire project including external libraries etc that I need for the project.
I can import the zipped project into eclipse but obviously the source directory is out of date. I need to be able to pull from my existing repo all the changes I made to my source files. I was able to use the Restore From Local History from the context menu in eclipse which brought in all my changes up until my last push.
Is there a way to re-link this newly create project with my existing repo so all my original commits are available to the new project? Or is there a way to get my source files from my repo into the newly created project. I'm not sure how to proceed and I don't want to make any further changes until I get this resolved.
Any help would be greatly appreciated.
Depending on how you restored the other files, you might run into merge conflicts once you pull from your remote repository. Make sure to make a backup first.
Eclipse:
In the context menu of your Eclipse project, you should see the entries
Team -> Remote -> Configure Fetch from Upstream / Configure Push to Upstream
There you can configure where to fetch from, and where to push to, respectively.
Once you have configured the URI to your remote repo, you might want to use the Dry-Run button to check that it is linked correctly.
Command line:
You can also use the command line to organize your remote repositories.
Navigate to your project and run
git remote
to get a list of your remote repositories.
If that list is empty, you can use
git remote add <remote-name> <your-remote-repo-url>
to add a remote repository. So, e.g.
git remote add origin https://github.com/yourUsername/yourRepo
Then you should be able to pull from your remote as usual.
Alternatively, you could follow this guide to import the remote repository as a new project. This will bring back the source code in its current state in the remote repository.
But you mentioned that the remote repo does not contain the whole project. So you would probably have to add all files manually from your restored project that were not tracked by the git repository.
Related
I've just finished a java course and a project in which we made a small java application. In the project we used github, but since we're all pretty much beginners to java and github this was a rather confusing process.
Therefore I might have made my NetBeansProjects folder, which is NetBeans' default folder for new projects, a repository to our project on github.
At least what happens is that every time I create a new project in NetBeans, it's automatically connected to our project on github.
I'd really like that my NetBeansProjects folder isn't connected to any remote github projects.
I have tried the git remote remove origin which resets the config by the looks of it but it doesn't solve the problem and any projects I create in NetBeans will still connect to our project on github.
Any suggestions to what might help?
If you don't need to keep track of anything in the Netbeans folder anymore, then you can just erase the .git folder which keeps all the git related data (you will lose everything that hasn't been pushed to github repo as well). The .git directory is hidden, procedure to make it visible (/display & erase it) depends on the OS you are using.
If you want to keep using git, you can add the folders you don't want to have in github repo into .gitignore file.
I have a Java project managed in SVN. This project has a remote folder - say - bin. When I create a branch from trunk, svn cp command is not copying this remote folder, but instead, it maintains the link back to the trunk. So, if somebody makes a breaking change on this file in trunk, then it is automatically reflects in feature or release branches and causes problems.
Is there a way to force SVN to copy this remote folder and all the contents under it? Or is there any other feature in SVN that lets me do this?
I am a newbie in dealing with Git. I am using Git in eclipse.
My main project contains the google-play-services_lib has a library project.
Recently I did Git -> Fetch from remote repository and now when I do Git -> Pull in main project, I get conflicts in google-play-services_lib which I never changed (generated files changes).
I want to ignore the library project changes from Git pull in eclipse.
Whenever I take Git pull from main Project, I always get the following conflict in eclipse-
Checkout conflict with files:
google-play-services_lib/bin/AndroidManifest.xml
google-play-services_lib/bin/R.txt
google-play-services_lib/bin/google-play-services_lib.jar
google-play-services_lib/bin/jarlist.cache
So though these conflicts are system generated changes, I always want to ignore them.
I used Team -> Disconnect on google-play-services_lib, but this only disconnected me from Git for the library google-play-services_lib.
I used Team -> Ignore on google-play-services_lib, but this did nothing in resolving conflicts.
I used Team -> Untrack on google-play-services_lib, but this added all files in google-play-services_lib in the conflict state.
Try the Options Assume unchanged and Assume changed:
Assume Unchanged to all of the generated files
Pull
Assume Changed to all the generated files
Because this will get very annoying if you have to do it for every commit, you could write a Script to handle this. The required commands are:
git update-index --assume-unchanged <file>
git update-index --no-assume-unchanged <file>
i am facing problem in importing project from github i.e,remote repository.it is giving no project found.and found the reason i should push .project and .classpath files also then only it will recognise the java project.but how to push them.
and i have 1more question
can i push more than 1 project into the remote repository.
i used following commands to push into the repository
git add .
git commit -m "intial commit"
git remote add swathi "https://github.com/swathiananthula/samplerepo.git"
git push swathi master
can anyone help me?
how can I import the project successfully into STS.
Remove .project and .settings entries (or any project config) from the .gitignore file and use git add . and git push.
The next time someone clones your repository they would be able to import it as a project.
Just note that though if you check in project files, make sure you don't have machine specific entries in your project settings as it will differ for each developer. This includes any classpath entries with full paths etc.
For your initial question; yes you can have multiple projects in one repository, though many would not recommend it.
I was working with a project that I was uploading the source to a SVN repo.
For a few weeks I dind`t uploaded any code.
My computer has broken.
I could access to the HD and recover my eclipse project.
Now if I import my project into Eclipse and I want to synchronize with my repo, all my files appear to be in conflicts.
Is there any way that I could "clean" my recovered project so I can stop having conflicts and in this way start to sync my project again with my repo?
When I open a file to see the changes, in those files, where I know that there is no change between my local file and the repo file, my local file version is lower than the repo file, example (local file version: 244 and repo version: 351). But there is no change between one and another file.
How can I get my project working again with my repo?
First do a team -> cleanup on your project. This sometimes resolves some SVN-specific tree issues.
Then go to the team synchronization perspective and do an update of the complete project.
Select the conflicts tab and resolve each conflicted file, there are two options: 'override and update' (dismiss your local changes and continue with the repository version) or
'mark as merged' (indicate that your local file is correct, and the repository version should be overwritten)
Before selecting 'mark as merged' you can use the diff tool to view each discrepancy in turn and edit your local file if necessary. Note that the diff tool has a setting 'ignore whitespace' which might help reduce the clutter.
After you are done, before committing anything re-build the project from scratch and run all your tests.
If you still get stuck there is a more drastic solution: make a fresh checkout of the project in another directory and then copy your local changes into it by hand. Make sure you don't copy any .svn directories!