Git copy changes from 1 branch to the other - eclipse

I am currently working on a project with 2 different branches for 2 different versions, I have Version 1.8 and version 1.9, each one is different, and I would like to keep both as they are both still being used. my 1.8 is my master branch, is there any possible way to make the 1.9 branch copy all changes made to the 1.8 branch, I am currently using eclipse with egit, but I am happy to use proper git if the need be.

In Eclipse select your project with right click and then Team > Merge > Select the branch 1.8 and solve the conflicts that you might have.
I'll suggest you to use SourceTree if you are new to git it is more easy to use.

Related

Different git merge between eclipse and intellij

I'v tried to merge a hotfix of my current deployed release branch into my develope branch.
Intellij found only the changes that were in the hotfix.
eclipse on the other hand found additionally some changes between the release and the develope and put them on the unstaged files.
Why is there a difference between the 2 IDEs? Do they use different git merge or diff? Do they choose different common ancestors?
Thank you!
No, IDEs don't have anything to do with GIT internal commands.
I think it was a mistake from your own side. I suppose you have two local repos for two IDEs, right?
May be you accidentally merged with different branch.
You said eclipse put some files to upstaged change, may be there's a conflict to that merge. Resolve it.

Git Branching in Eclipse

I have two different projects, but some feature are same for both project. Both projects are commit to server as Master. I want to make configuration so that i can pull the selected changes of project 1 to project 2 but I want to keep remote of both projects different.
Note: I am new to git and I am using Eclipse.
You can make patchs of the changes you want.
But, Why do you need to keep two git projects? You can keep one git project with two branchs.

Changing the git branch on eclipse

This is the first time I do this.
I imported a git project in eclipse.
Then I used the shell to create another branch and checkout to the new branch.
Is refreshing the imported project in Eclipse enough to tell Eclipse that we are working on the new created branch?
thanks
Right-click your project and select Team → Branch to create new branches or to switch between existing branches. You can also switch branches in the History view.
Actually, I don't think you even need to refresh the project. That is, assuming you have 'eGit' installed and your projects are already configure as git projects (they should be, because in most cases, egit does that automatically).
Whenever you run git commands on the shell (outside eclipse) egit will automatically refresh projects for you and update their status when you switch back to Eclipse.
If you are not using egit then yes, you have to refresh the projects manually, but that is all you'd have to do since running the 'git checkout my-branch' command in the shell already changed the files on disk to be those from 'my-branch'.
Actually when you are working with eclipse, eGit is a very cool tool integrated inside eclipse, which lets you do all git stuff, like
git checkout to a new branch
git create new branch
git stash
even view your unstaged changes(select files and avoid complexities caused by git add .)
and finally commit.
Read here to know more. Eclipse Egit user guide
So you get to do all version repository stuff at one place as you code.
So to answer your question, yes as you checkout a new branch even in a shell/command prompt your changes will be reflected in eclipse.

Pull multiple Git repositories with EGit on Eclipse at once

I have cloned ~60 git repositories and I would like to update the most of them with git pull through EGit. Not all, because some of them have uncommited or unstaged changes.
My first try was to select two repos in EGit (Git Repository Exploring view) but unfortunately this seems not to be possible, since the affecting button is disabled (context menu).
Does andbody know a good solution to update some repositories through Eclipse?
I am using Ubuntu 12.04 and Eclipse Juno. Sure, a shell script could solve this but I prefer Eclipse for this.
I just discovered the answer, using Kepler. This was a nightmare for me with 15 repos.
Eclipse->Windows->Preferences->General->Keys. Now scroll to Pull (make sure it's the egit one)
Set it to something like Ctl-Shift-P
Now in package explorer select the ones you want and press Ctl-Shift-P, done.
Sometimes the solution is too simple: one of my cloned repositories had no HEAD and therefore I cannot pull from it. All other repos had a HEAD revision and pulling from them works as expected.

Load former version into working tree and start new branch

I just started working with Egit and I don't understand how to jump back to a former version of a file (or project) and start a new branch from there.
Example:
I create a single text file in an Egit shared project:
Version 0.98
Version 0.99
Version 1.00 First Release
Version 1.01
Version 1.02
I commited after each line (i.e. five times). All is done in the master branch.
My goal now is to load Version 1.00 back in the working tree and start a new branch from there.
Maybe I misunderstand some Egit principles but I think that this is a common way to use code version control. So how can I do this in Egit?
I use Eclipse Indigo (3.7) and Egit 1.0.
Just click on the commit in the History view, which made Version 1.00, and select Create branch. In the dialog keep the checkbox "Checkout new branch" selected, type a name for the branch and hit Finish.