0

I've looked the introductory video, but I do not really find clear instructions on how it is possible to easily cherrypick between an old/new version of a file in magit.

What I'm trying to say is that in e.g. eclipse (which I don't like it all, except for git), it is possible to scroll through the old and new files, and click on the arrow for each change to say which to keep. It makes merging really easy.

Is there any help/nice way to cherrypick each single change in Git/Emacs, possibly Magit?

PascalVKooten
  • 20,643
  • 17
  • 103
  • 160

2 Answers2

2

Go to magit-status, e.g. press TAB on a staged file, it will expand and then selecting a part of the diff, you can stage/unstage it. Very great!

Read about it here:

http://www.masteringemacs.org/article/introduction-magit-emacs-mode-git

To stage or unstage you can type s or u to stage/unstage the item (be it a whole file, or just a hunk) – however, there’s one more very useful tip. If you use the region to select a portion of a hunk and then press stage/unstage then Magit will automatically stage or unstage just that selected region! That’s extremely useful for fine-grained control when a diff hunk itself is not good enough.

PascalVKooten
  • 20,643
  • 17
  • 103
  • 160
1

If i understand you correctly you want to choose which change to take from the current file and which not to pick.

you should use the git CLI with git add -p.
The -p is used for picking hunks.
For more info about hunks read here.

CodeWizard
  • 128,036
  • 21
  • 144
  • 167