How to partially save merge results? - merge

I'm now in the middle of 3-way merging using ClearCase "Diff Merge" tool, and I want to stop and do the rest tomorrow.
I'm afraid that my machine may halt or restarted, so I want to save the merge results I made so far.
The problem is that the "Save" button is disabled, and it seems that it will be enabled just after I resolve all conflicts.
On the other hand, if I try to close the tool, it warns me that there are unresolved merge points so I could not resume the merge later:
Is that possible somehow to save it right now even before I resolved all conflicts?
Thx

Not that I know of: The merge Windows control allows you to go from unresolved merge to unresolved merge, but not to save a merge in progress.
What I usually do is (if we are talking about the merge of one file, merge in text mode):
save the current resulting merge content (the fourth panel content)
cancel the merge in progress
Then later:
checkout a new version with the saved content (or used the checked out version and overwrite it with the saved content)
merge to that new version (which already contains what I want to see from the part I resolved previously)
Note: if you know that all resulting merge conflicts should be resolved with root (1), ours (2) or "their" (3), you could click on "Navigate > Resolve-and-Advance mode", and quickly click on 1, 2 or 3.

Related

How can I amend a commit in GitKraken to unstage a file?

I just committed three files to Git (Class1.java, Class2.java, and Config.xml). Then I realized that I made a mistake, and didn't actually want Config.xml in that commit. Now I want to amend my commit and unstage the changes to Config.xml, so that the (amended) commit contains only the changes to Class1.java and Class2.java.
This is easy in Git Gui; select "Amend previous commit", and the "Staged Changes (Will Commit)" list shows me all three files that were changed in the previous commit. I can unstage Config.xml and commit.
But in GitKraken, when I check "Amend", it doesn't show me the three files from the previous commit; it just shows me a blank slate. There's no clear way to unstage one of the files from the commit I'm amending.
I know I can use the command line (or Git Gui). But is there any way, from GitKraken, to amend the previous commit and simply remove one file's changes from it?
Your observations are correct: You can't.
There is no way to remove changes from a commit via amend at this time, as far as I know. You can only add other changes to the commit (which may of course nullify some of the changes you commited before). As you correctly observed, this is because GK does not show you the previous commit when you check Amend, you can only add your unstaged changes.
A pure GK workaround would be a soft reset to the previous commit and a new commit only containing Class1.java and Class2.java. The result would be the same, since an amend would also create a new commit.

Eclipse CVS compare: difference not disappearing after copying

In Eclipse, CVS text comparing works poorly against large numbers of difference between the local and the remote version. It's very desirable to update the the status of comparison every once in a while by a simple command. Basically it's reloading the local file, do the comparison again, to see where we have reached, and try not to make mistakes.
Unfortunately, "Team" - "Synchronize" again after editing every several lines is not convenient, neither does it solve our problem. As I have observed, when there are many differences, Eclipse can mark the already identical lines as different to the remote ones, if we use this approach to compare again.
How can we solve it in Eclipse?
At last I found a simple enough solution, but can be ignored easily: use the "Java structure compare" panel.
When doing the CVS comparison, above the two horizontal text area, we can see the "Java structure compare" panel.
The icon "+", "-" and arrows can show structurally how the two files are different.
Double-click on a method to edit. After several lines of work, double-click the method again to update the status of comparison. If the local version is identical to the remote one, all the color squares will dissappear from the vertical scroll bar on the right, clearly marking where we have reached. Also, after doing this, you jump to the next difference in this method, to start working again.
Re-"Synchronize" will mess the whole file up, so don't do it in the middle, unless you are at the final stage and have fewer enough differences.
Just a little piece of humble opinion about how to use Eclipse more efficiently. After all it's our daily tool. Better to learn these tricks as soon as possible.

magit merge conflict `checkout --theirs/--ours`

Sometimes when resolving a git conflict, I'll know that one side is better for a file and I'll resolve it with git checkout --theirs path/to/file.
However it is not obvious how to do this in magit, so I always drop to the CLI to do it. Is it possible to do this easily?
On the next branch (what will be 2.1.0), when you are rebasing and discard a conflict ('k'), you will be prompted and have the option to select --theirs. You can also call magit-checkout-stage directly and select the file and --theirs flag.
For version 1.2.*, I think using Ediff with magit-interactive-resolve is the closest you can get.
If you right-click on the arrows at the head of the conflict
<<<<<<<< HEAD
a menu will appear and will let you select the appropriate action.

Accidental commit; how to not push an unpushed commit in Magit Emacs

I did an accidental commit which really makes no sense to have anywhere in history. How can I remove this commit from existence (especially I don't want it appear remotely).
In the magit-status, it shows:
Unpushed commits:
fe73b07 updated gitignore
974e70d test
ab333e6 trying to go with a flat structure
What can I do?
Bonus: actually, I just want to keep the "updated gitignore" from this commit.
Point at test, press E to start a rebase. M-n two swap commits. C-c C-c to finalize.
Resolve merge conflicts if any and done.
This is more a git question than an emacs or magit question really. If I understand you correctly, you want to get rid of older commits. One way to go about this is to re-order your commits and than get rid of the last two commits.
The first amounts to picking the right commits during rebase, the latter amounts to using the right incantation of git reset. I would suggest you take a look at this link on reordering commits. In addition, I would urge you to take a (ton of) look(s) at this useful fixup section of the step-by-step adventure through git.
Like #abo-abo said, initiate an interactive rebase by putting point on the first commit you want to remove and then pressing E (on Magit's next version ee.
A new log-like view appears, with every line prefixed with an action, initially pick. Then press n to move to the first commit you want to remove, and k, which will strike out that line meaning to drop that commit. (That's what happens in the ui, when this information is later feed to Git, the line is actually removed). This also moves to the next line, which in this case is the other commit you want to remove. So press k again.
Now that all commits you want to remove are marked as such, press C-c C-c to tell Git to make it happen.

Mercurial+TortoiseHG revision back out

Here is the problem. Say, I have revision 1 and 5 (quite a lot of files and lines of code were added in the later). Now I need to return the project to the state of the 1st revision and that's what I understand the back out is for. But I always end up with all the files and lines of code I don't need anymore.
What you want is update, in your case hg update -r 1 (select revision 1 in hg workspace, right click on it and select update).
Backout has a very different meaning: it reverses the changes of one particular revision, so that afterwards it seems, that this revision did not happen (of course it is visible in the project history, but the changes to the working copy are gone.)
Files, which are not in version control can be removed with hg purge (I don't know if this command is available in tortoiseHg).
When you even don't want the revisions 2-5 anymore (and are really sure about that), you can enable the mq extension, and strip the unwanted revisions.