In Eclipse git, I have created my local branch from source "S1" branch and pushed the changes. But now different source "S2" is created and I am asked to send merge request on the "S2" branch for same code changes.
I am new to Egit , can Any one tell me how can i duplicate my local branch from S1 source to S2 source?
From Git Repositories
view, checkout branch S1 then open history, select the last commit from S1 (or whatever commit you'd like to start S2 from), and then right-click on the commit > Create branch...
.
Note that Git and EGit don't force you to have a branch named S2 to push to a remote named S2. You can simply work on S1, commit on S1, and in the Push...
dialog, set S2 as target ref. That should create the remote S2 branch with last commit included.
In general, it's important to keep in mind that a git push
action always has a src local ref (commit or branch) and a target remote ref (branch), and that those don't need to have the same name. Even if src and target refs in git push
commands are (too) often ignored and made implicit, keeping that in mind and using "disambiguised" git commands often allows to better understand navigation. EGit push wizards is smart enough to make it explicit and pre-set to good default (you'll usually won't need to change), so you get best of both worlds.