In git using eclipse i want to current commit of one Branch to the previous version different Branch.
Using "Compare With" option in eclipse, i was able to compare with different branch or with same branch previous versions. But i want to compare with different branch's previous version.
For e.g Branch A has 3 commits aa ab and ac.
Branch B has 3 commits ba bb and bc.
I want to compare branch B's bc commit (latest) with Branch A's aa commit (not with command line)
It appears that the eGit plugin supports what you want to do:
Comparing Two Commits
Select a resource in the Package Explorer
click Team > Show in History or Compare With > History... (the latter for files only)
in the commit graph select two commits
right-click Compare with each other
this will open a compare dialog showing the changes between the two selected commi
you can also open a Git Tree Compare view by right-clicking Compare with each other in Tree
The trick will be in finding the commit graph view so that you can manually choose the bc and aa commits from your two branches.
Project file - Right Click -> Team -> Show in history
ctrl+click the two versions you would like to compare
Right Click -> Compare with each other
This will bring up the two versions you would like to compare
Related
I know in eGit there's compare to "commit.." option but that may not include the given revision I'm trying to compare with.
Say, in one specific build the revision is a3. The file was modified in revision a1, a2, a4.
a3 happened after a2.
The problem is that in the list of options in eGit's compare to "commit..." a3 revision isn't there because the file wasn't modified in that revision. I want to compare a file in my working copy or in the latest revision to whatever that file contains in revision a3.
I'm trying to avoid the tedious process of finding out what was the last revision that changed the file before the given revision.
Yes, EGit filters the list of Compare With > Commit... to the commits that modified that file, otherwise the whole history would be shown there.
Do I understand you correctly that for your specific use case, you already have the commit hash of the revision to compare to in hand?
If so, it would be relatively simple enhancement if one could input an arbitrary commit ID in the Compare With > Commit... dialog. Could you please file an enhancement request here?
How to do it currently:
In the file context menu, use Team > Show in History (or Show In > History)
Disable filtering in the view by selecting the repository icon (Show all changes in repository containing the selected resource)
Find the commit you want to compare against (using the find button or scrolling)
Open the context menu of the commit and select Compare with Workspace
We recently switched from svn to mercurial. We're using Aptana as our IDE with the MercurialEclipse plugin, along with BitBucket for our repositories and SourceTree as our (additional) source control GUI.
I created 2 new files in Aptana, and committed each of them. Now in the Synchronize view, where the 2 files are listed as "outgoing", I'd like to push only one of them. I avoided using the "push all" icon at the top which would push all outgoing changes - instead I right-clicked a specific file in the outgoing list and chose "push" from the context menu. However, this caused both outgoing changes to be pushed. I can't seem to find any option to push only a specific file or subset of files of the committed changes. Is there any way to accomplish this in Aptana?
Note: My answer doesn't relate to Aptana, but instead covers what I think your issue is.
I think the main problem is a misunderstanding of how Mercurial stores its changes, which coming from a Subversion background is perfectly reasonable.
In Subversion, change history can be considered to be stored per file. That is, if you change two files and commit them, you can easily, and often do, have a situation where files in your working copy are at different versions.
In Mercurial, change history is stored across the whole repository. Committing will create a new "Changeset", which stores the state of the entire repository at that time. When you decide to push a change out to another repository, all modifications (or adds, or deletes, or...) will be pushed out with that change.
A caveat is that when you decide to commit a new changeset to your repository, you can selectively include or exclude files. Files not included will remain in your working copy as pending modifications, which can be committed in a new changeset.
I hope that makes sense to you - if you already understand it, it's a logical concept, but I find it tricky to explain.
So, on to your problem.
Lets say you have two files in your repository, file1 and file2 (it's that or foo and bar). You've changed them both, but they relate to different issues - they can be committed as different changesets:
$ hg log
changeset 0:....
summary: First commit
$ hg st
M file1
M file2
$ hg commit -I file1 -m "Changed file1"
$ hg log
changeset 1:....
summary: Changed file1
changeset 0:....
summary: First commit
$ hg st
M file2
Here you can see that we've committed only one file into the repository, and it's made a new changeset with the complete state of the repository at that time, minus the changes to file2. We can now do the same, committing file2, which will create another changeset. The problem with this approach is that changesets are ordered according to their parent, and so you couldn't easily push just the change to file2, without also pushing its parent - but it may be closer to what you're after.
TL;DR : SVN stores the state of individual files, Mercurial stores the state of the repository as a whole.
I very much recommend reading Mercurial: The Definitive Guide. It's a little out-of-date in places, but I think it will do a much better job of getting the concept across.
Using git, I created a local branch to work in. Then I committed my work progressively. So, I get 3 commit in the same pull request I'd liked to merge them into a single one.
I founded that there is a way to do it if we follow these steps:
git rebase -i HEAD~3
=> All commit in the branch are listed as below
pick mycommit1
pick mycommit2
pick mycommit3
To meld them into the first one, I have to set the commands of mycommit2 and mycommit3 to squash instead of pick
But, in my case, there is lot of commits between my commits in the master branch, thus, I can not do this.
By consequent, I would ask if I can do the merge JUST in my pull request.
Your ideas are welcome.
Thanks
You can use the fixup command while rebasing. This command does the same thing as squash but while keep the message of the first commit. For instance:
pick 123abcd
pick abc1234
pick a1b2c34
You can change this to:
pick 123abcd
f abc1234
f a1b2c34
Now you join these 3 commits into one commit which will get the first message. If you want to edit the message once, you can do it like this:
pick 123abcd
f abc1234
s a1b2c34
This means that these 3 commits will be joined into one commit and you can edit that commit.
Extra Tip: To make it easier to change every pick to a command, you can simply use Vims block select feature to select all 'pick's and change it to the command you want.
In CVS I have a branch (b) off another branch (a) which is off the trunk/head.
Some bug fixes were made in branch (a) that I'd like to go ahead and use in branch (b). How can I pull those fixes into my branch in Eclipse?
head
|
v
a (with bug fixes)
|
v
b (needs bug fixes)
Ideally what you need is to have two tags on a for every feature you want to merge, and then merge the difference between those two tags into b. However, you would also need to remember which ones you have already merged, because CVS doesn't remember that.
When I was working in a company that used CVS and branches, our policy was that bugfixes from branches (a in this case) that ought to be used by other branches need to get merged into the trunk first, and all the other branches merge them from there.
However, it was still very painful if you wanted to cherry-pick individual bugfixes. Essentially, you'd have to remember every fix you've merged (by two tags, marking the beginning and the end of the changes making up that fix).
Generally, in CVS it's much better to remember (in a tag) up to which revision you have merged, and merge everything from there to the head (and then move the tag to the head). In CVS, cherry-picking is painful and requires you to store the merge history somewhere.
Do you know any tool that support the followings:
eclipse integration (not mandatory)
merge tracking
interactive merge
merging with selecting changesets, but commit them one-by-one to preserve commit comments
So the flow I expect:
picking the source to merge to workspace
choosing revisions to merge
the program would do the merge for the first revision, would pop up conflict resolving if any, and if no conflict it would commit with the original commit comment + merging info with appropiate svn properties
go to next revision.
Do you know such tool?
No, I doubt any tool does this exactly as you describe - why would they when you can a) replicate the functionality by merging 1 revision at a time anyway, b) prefer to make the commit a manual process so the operator can check the merged results. Having merges commit automatically is just slightly optimistic.
You could write such a tool with script - for each revision, merge, fetch original log comment, commit.
Note you don't need to worry about properties as they are merged automatically as part of the merge process.