How do I work on a branch in SVN Eclipse? - eclipse

I've read multiple documentations already but I don't seem to get it - I want to branch one project folder of our rcp, change something there and test with the changes I've made there.
Which steps do I have to make to work on the branch? How do I integrate the branch in my workspace for testing without ruining my local files and what does Switch... do?

Working on a branch directly through Subclipse isn't possible. You have to check out to your local machine first and then commit back.
This will override local changes, so make sure to branch them first.

IF you want to test your quick changes in your project without your local changes ,this is what you can do
-Create a new branch of the trunk/active of your project in SVN
-Checkout the new branch from SVN as its own project
make your quick change . Test it locally
Check it back into the branch. When you are ready, merge your code.

Related

Eclipse, Egit, Github: remove pushed project folder

I have successfully created a git hub repository, a local master, committed the initial changes and pushed them to github.
Unfortunately the project folder from Eclipse ends up in the repository. For example:
<username>/<gitrepositoryname>/<eclipse project folder>/<project files & README>
when for most people it looks like:
<username>/<gitrepositoryname>/<project files & README>
I created a new local master after I found this tutorial Push eclipse project to GitHub with EGit
but now I am running into push problems such as "HEAD rejected - non-fast-forward" when using the new local master.
Can some please help me to correct this locally/remotely? Is there a way to switch local master branches so that I can sync the correct one with githib?
Thanks in advance.
It's pretty simple to fix:
Go to the "workspace" where you keep <eclipse project folder>
Make sure to delete the .git folder there
Tell git to force push the changes. (Checkbox) (It's usually not good to force git to do something, because you could loose commits/data BUT here, we really want to overwrite the old repository with the new one.)
Your changes should be up immediately. Next time you push, please make sure, the force push checkbox is disabled again

Git in Eclipse: How can I overwrite the changes on the repo?

I am very new with git and repositorys and I have a problem. Me and my collegue were working on the same file.
He commited and pushed his changes.
I commited my changes
I pulled
Now I have conflicts and I want to solve them. How can I overwrite the conflicts so that my changes are on the file? I am working with Eclipse.
There is no easy way to resolve conflicts. But tools are available to make the process a little easier. Anyhow you will have to decide and manually make the changes so that both of your changes are available in the latest file.
Try: git mergetool
If you both edited separate parts of the file then the tool will automatically merge whereas if you both have edited the same part then some manual interaction is needed.
If you want Your changes you can use:
git fetch -p
git merge --ours
This will merge the remote with your local branches and in case of any conflict - use your version of code.

Hg Mercurial - Upgrading code not in repository

I have a customized local repository of NopCommerce 3.5. The new version of NopCommerce (3.6) is out and I would like to try to update to it. I downloaded their source code and I would like to somehow replace all the files in my local repository with the new files (outside the repository) and then have mercurial detect the changes and merge them with my changes. Obviously the merge would be manual but I have no problem with that.
In case I am not explaining this properly, let me give you and example:
I have file foo.cs (v3.5) which has custom code in my local repository. I downloaded the new foo.cs (v3.6) which is not in any repository. How can I merge them so that I can keep my changes and the the new changes added by the NopCommerce team?
This is what I have tried so far:
I created a new branch called "Nop3.6" and replaced foo.cs. Then I tried to merge the "Nop3.6" branch with my "default" branch hoping to be able to merge manually and keep both, my custom code and the new changes added in foo.cs (v3.6).
As you might expect this didn't work. my foo.cs file (v3.5) was completely replaced with the new foo.cs and all my changes were lost.
Any help in the right direction would be much appreciated.
Doing the merge vice versa (your changes into v3.6 might work better. Also make sure that you have selected a reasonable merge tool (internal works, but there are possibly more convenient ones out there, I use kdiff3 myself):
I assume you have a repository with v3.5 and on top of that you have one or several changesets which are your own modifications of that source. If you haven't committed your changes as changesets on top of v3.5, then do that now.
Then, in order to get a decent merge with v3.6 do the following:
update to the unmodified v3.5 again. Copy v3.6 over this and commit the complete change as v3.6. You end up with a repository which has two anonymous branches with v3.5 being their common ancestor.
Now you can merge those two branches. As you possibly want to keep your changes on top of v3.6, update to v3.6 and merge your local changes into that branch.

Changing git branch while working with eclipse (what's proper order)?

my problem is that sometimes I change git branch while working live in eclipse. But I do not know what should I do (in what order to to, to don't make mess in both projects).
So my procedure is:
eclipse is open (working on some problems)
git change branch
eclipse > selecting projects and clicking to refresh
work on eclipse, continue job
Is it all right or I should use first Clear&Build and then refresh projects? What do you think, is it important witch order do this while changing branch ? Please help because I am working with friends on big project and I do not want break anything.
If you are working on a particular branch and you want to preserve whatever it is you have been doing, you should add or commit those changes first (git add or git commit) to that branch before changing to a different branch.
If you have the same projects in both branches, then refreshing the projects after changing branch should be fine, but ideally followed up with a clean/build.
If you want to be really safe, you can first close the projects before changing branch, then refresh and re-open them after changing branch.

Am I using EGit and Eclipse correctly when working with repositories?

I'm trying to set up EGit with Eclipse and I've used neither of them before. I understand the basics around Git and Eclipse is more or less just another IDE. The problem I'm having is setting up a reasonable work environment.
I have file-server at home which I want to use as a Bare repository which I push and pull changes to. To test it out I've done the setup locally.
I have a bare repository created through the Git Repository perspective.
I've cloned that repository into a local non-bare repository.
I've created a project in a subdir of the non-bare repository (is this the way to go? Is it possible to do have the project directly in the workspace with the .git folder within it? So far I've had a lot of trouble with it when trying to create an Eclipse project out of it. What is the proper way to do it?)
I've made some changes to this cloned repository and added the indexes, committed the changes and attempted to push the changes to upstream.
The thing is that no changes are made to upstream. Would someone like to explain the procedure in doing the push so that I'm not misunderstanding something? Or am I completely wrong on utilizing a bare repository instead of just working non-bare?
As mentioned in this tutorial, you create your Git repo right where your project is (ie your .classpath and .project files are).
Pushing to a bare repo is a good idea (see the links mentioned in "Git - pull & push - production server")
You need though to specify what you want to push:
Click at least on "Add all branch spec".