git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Andre Ulrich <andre.ulrich@smail.fh-koeln.de>,
	"brian m. carlson" <sandals@crustytoothpaste.net>
Cc: Johannes Sixt <j6t@kdbg.org>, Git Mailing List <git@vger.kernel.org>
Subject: Re: fast forward merge overwriting my code
Date: Tue, 25 May 2021 21:53:24 -0500	[thread overview]
Message-ID: <60adb824bac10_2c7f620844@natae.notmuch> (raw)
In-Reply-To: <20210524061355.Horde.I7EpK9A1l-KtI_TwFo97eNd@webmail.th-koeln.de>

Andre Ulrich wrote:
> So the last point is where we still want to do some fine tuning. Right  
> now this looks about: my prof fetches my edits and locally checks out  
> a branch to compare the changes with git diff.
> But in this diff view you can't edit the files. So you have to  
> separately open up another window to edit the changes (lets say my  
> prof only wants to keep some of my changes, but not all).

So for example after fetching your changes your professor sees this:

  % git diff --cached
  --- a/README
  +++ b/README
  @@ -1,5 +1,7 @@
   This is an example document. Lot's of things to fill in.
   
  -[[ insert formula]]
  +The fromula is:
  +
  +  y[1], mu * (1 - y[0] ** 2) * y[1] - y[0]
   
   This will help students jump straight in with simple examples.

The professor can then open the file, fix the typo, do some other
changes, type `git add --update`, then do `git diff --cached` again to
see if that's the output she wants:

  --- a/README
  +++ b/README
  @@ -1,5 +1,7 @@
   This is an example document. Lot's of things to fill in.
   
  -[[ insert formula]]
  +The formula is:
  +
  +  x[1], mu * (1 - x[0] ** 2) * x[1] - x[0]
   
   This will help students jump straight in with simple examples.


What you are saying is that it would be better to do `git $cmd` and in
that command you would be able to view the staged diff, edit the diff,
and after quitting the editor the diff is applied to the stage.

Essentially leaving everything ready for a commit.

Sort of like a combination of: `git diff --cached`,
`vim $problematic_file`, `git add $problematic_file`, `git diff --cached`.

Correct?

> So my Question is: is there any possibility, to be able to view (and  
> even edit, if necessary) the changed notebook in the merging process  
> (as in my example with the 3way merge)?
> Or is the only option to separately view the diff and edit the  
> notebook (two seperate steps instead of one)?
> 
> The latter would also be acceptable, if it really is the only way. Bu  
> it would be nice, if viewing and editing could be done in one  
> convenient step during merging.

You are describing `git stage edit`, a subcommand I suggested back in
2014 and went completely ignored [1].

Your professor just types `git stage edit`, fixes any problems she sees,
quits the editor, `git commit`.

Done.

I just rebased the patches from 2016 and they seem to work fine. If you
are interested let me know.

Cheers.

[1] https://lore.kernel.org/git/1398449567-16314-3-git-send-email-felipe.contreras@gmail.com/

-- 
Felipe Contreras

  parent reply	other threads:[~2021-05-26  2:53 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-22 15:48 fast forward merge overwriting my code Andre Ulrich
2021-05-22 17:12 ` Philip Oakley
2021-05-23 15:01   ` Junio C Hamano
2021-05-24  9:50     ` Philip Oakley
2021-05-23  9:48 ` Johannes Sixt
2021-05-23 23:58   ` brian m. carlson
2021-05-24  6:13     ` Andre Ulrich
2021-05-24 11:13       ` Bagas Sanjaya
2021-05-24 13:16       ` Philip Oakley
2021-05-24 15:06         ` Andre Ulrich
2021-05-24 18:48           ` Philip Oakley
2021-05-25 15:14             ` Philip Oakley
2021-05-30  5:31             ` David Aguilar
2021-05-30 11:00               ` Philip Oakley
2021-05-24 17:47       ` Igor Djordjevic
2021-05-26  2:53       ` Felipe Contreras [this message]
2021-05-26 11:06         ` Philip Oakley
2021-05-26 18:33           ` Felipe Contreras
2021-05-26 20:35             ` Philip Oakley
2021-05-26 23:34               ` Felipe Contreras
2021-05-27 12:05                 ` Philip Oakley
2021-05-27 14:00                   ` Felipe Contreras
2021-05-27 15:12                     ` Philip Oakley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60adb824bac10_2c7f620844@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=andre.ulrich@smail.fh-koeln.de \
    --cc=git@vger.kernel.org \
    --cc=j6t@kdbg.org \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).