0

the question is basicaly the same as Viewing changes to deleted files in git but for a rebase rather than a merge.

So :

Let's say that when I branch off from master, there's a file colors.txt on the master branch of my repo with these contents:

red
green
blue
yellow

I then branch off into my-branch, in which I make the following changes:

  1. Delete colors.txt
  2. Add red.txt with these contents:
red
  1. Add green.txt with these contents:
green
  1. Add blue.txt with these contents:
blue
  1. Add yellow.txt with these contents:
yellow

Now, I know some other guy have been doing modification in this file on master, so before going further I decided to rebase onto master. The file colors.txt has been modified to:

red
green
blue
yellow
orange
purple

During my rebase, the only information I get is that I deleted the file colors.txt

deleted by them: colors.txt

the fact that the message is deleted by them is already confusing, but that's not the question

So how can I see the changes that have been made to the file on master so I can appropriately resolve the conflict (in this case, by adding the files orange.txt and purple.txt)?

I can't use the solution of the linked question because they are merge specific.

jota
  • 23
  • 7
  • You make things to complected. When you do a marge, conflicted files are shown in form showing changes in current branch and branch which is merged. If you are intimidated by `>>>>>>>` `<<<<<<<` in conflicted file, there are tools which visualize this quite nicely. I'm using: `kdiff3` (free) and `Beyond Compare` (commercial, but my favorite). – Marek R Jul 16 '19 at 09:24
  • I think you don't read correctly the question, or I have not express correctly my issue. I have no problem with conflict resolution, and I am not talking about merging. You can redo the step I've describe in the question if you want to see my issue. – jota Jul 16 '19 at 14:00

1 Answers1

0

so I came up with an alias:

[alias]
deleted-diff = "!git diff \"$1\"..$(git merge-base \"$1\" \"$2\") -- \"$GIT_PREFIX$3\" #"

Usage:

git deleted-diff $1 $2 $3

$1 is the branch on top we are rebasing

$2 is the branch actually rebased

$3 is the name of the file

for your records:

the \" are used to be procted from dangerous file name or space into them

$GIT_PREFIX allow the use of relative name for the file

jota
  • 23
  • 7
  • `git diff a...b -- x` does same thing (note three dots). So this alias gives nothing but name. – Marek R Jul 16 '19 at 09:20
  • the ... did not work during a rebase because b is on top of a. So there is not diff to show. This is why I specify that this solution is merge specific. – jota Jul 16 '19 at 14:01