5 ms·
> but rather around being selective about crafting self-consistent but single-theme revisions Actually, I think git's got Magit beat on that. Magit might make
by jolmg 5y ago
> but rather around being selective about crafting self-consistent but single-theme revisions
Actually, I think git's got Magit beat on that. Magit might make it easier to stage specific lines, but git can stage specific parts of lines or even changes that are completely different than what's on the worktree, through the editing of diffs with `git add -p`'s `e` option.
- dan-robertson 5y agoWhat percentage of git users do this compared to the percentage of magit users staging line-by-line or confidently amending/cherry-picking/interactive-rebasing?
- deleted 5y ago[deleted]
- TeMPOraL 5y agoI'm somewhat convinced you can replicate that last feature (staging arbitrary / sub-line pieces of your changes) through ediff-staging (E s), but ediff is a complex tool in itself, and I don't know how to use it properly yet. (Ediff is a 2-way / 3-way interactive diffing interface, built into Emacs, with plenty of features for surgical diffing of files, buffers, directories and whatnot.)
- deleted 5y ago[deleted]
- NateEag 5y agoMagit has great support for staging parts of lines - select the section you want to stage and press 's'.
- amake 5y ago> Magit has great support for staging parts of lines This is news to me. > select the section you want to stage and press 's'. It stages line-wise for me. How do I get it to stage less than an entire line?
- PaulDavisThe1st 5y agoThe second line you quoted tells you how.
- gpderetta 5y agoWhen selecting only part of line, 's' will still stage the full line for me.
- jolmg 5y agoIndeed. cd $(mktemp -d) git init echo bar > file.txt git add file.txt git commit -m "init" echo foo_bar_baz > file.txt # select only "foo_" in magit-status and press "s" git diff --cached will show diff --git a/file.txt b/file.txt index 5716ca5..2fd000c 100644 --- a/file.txt +++ b/file.txt @@ -1 +1,2 @@ bar +foo_bar_baz rather than the desired diff --git a/file.txt b/file.txt index 5716ca5..2fd000c 100644 --- a/file.txt +++ b/file.txt @@ -1 +1,2 @@ -bar +foo_bar I can't really imagine this feature working that well with just selection. Editing of the diff seems required. I just updated magit, too. It seems to have been published 3 days ago.
- NateEag 5y ago..huh. I just tested this in my Emacs instance and it works as you describe. I could swear I remember this working in the past, but I can find no hint of it in a few quick searches, so I'm likely mistaken. I'm sorry for the misinformation. Thanks for saying something.
- deleted 5y ago[deleted]
- amake 5y agoIt does not. As I said, pressing s does not stage less than a line for me, even if my region is a subset of the line.
- fouric 5y ago