Skip to content

view like git diff --color-moved #865

Open

Description

@skyfaller

Sometimes code has simply been moved around, rather than deleted or added. It would be nice to be able to see this at a glance. The command git diff --color-moved will display this, or you can set --color-moved to be git's default with a command like git config --global diff.colorMoved default.

Sadly I do not see an option to achieve this behavior in gitui.

Describe the solution you'd like
I would like an option to make code that has been moved visually distinct from code that has been added or deleted. I think this should be visible when viewing diffs in the Status [1] tab.

Personally I think this should be enabled by default, but I'm certain some number of people will disagree with me.

Describe alternatives you've considered
The alternatives are manually looking to see whether code has merely moved, or to drop back to the git command line.

Additional context
delta successfully supports this feature: dandavison/delta#72

Here's a blog post that alerted me to the existence of this feature: https://danyspin97.org/blog/modern-cli-applications-part-1/#bonus-color-moved

Activity

  1. stale commented on Nov 19, 2021

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  2. skyfaller commented on Nov 19, 2021

    @skyfaller
    Author

    Please remove stale bot, it contributes nothing to the conversation: #996

    This still seems like a desirable feature that shouldn't be too hard to add.

  3. removed
    dormantMarked by stale bot on close
    on Nov 19, 2021
  4. extrawurst commented on Nov 20, 2021

    @extrawurst
    Collaborator

    @skyfaller I appreciate you bringing up this feature request but it did not convince any contributor willing to invest their free time to work on it. the stale bot is not deleting or preventing active conversations. this ticket stays around forever and for future reference.

    Still if the bot would not be around I would manually close issues that qualify as:

    • not actively discussed
    • not actively worked on
    • not part of the roadmap
    • not committed to being implemented by a contributor

    this reduces the cognitive load of managing this project for me, nothing personal against you

  5. skyfaller commented on Nov 22, 2021

    @skyfaller
    Author

    Can you say anything about what it would require to implement this feature, perhaps as guidance for someone looking to get involved with gitui development and finds this issue interesting? For example, where the code is that emits the diffs in the status tab?

    Do you have any opinions on the three possible approaches that delta considered? Delta had to make some tradeoffs between syntax highlighting, Git's color-moved option nuances, and complexity/fragility, ultimately choosing to sacrifice syntax highlighting on moved lines for now. Are all of these options open to gitui? Would you want to make the same tradeoffs?

  6. stale commented on May 31, 2022

    @stale

    This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  7. skyfaller commented on May 31, 2022

    @skyfaller
    Author

    Another related feature that would be cool is git diff --color-moved-ws which controls how whitespace is or isn’t ignored when colorizing diffs. You can think of it like the other space-ignoring options (like --ignore-space-at-eol, --ignore-space-change, or --ignore-all-space), but specifically for when you’re running diff in the --color-moved mode.

    Here's an example of how that is useful, when looking at code where the indentation changed but not much else: https://twitter.com/jb55/status/1129758919973396483

  8. removed
    dormantMarked by stale bot on close
    on May 31, 2022
  9. stale commented on Dec 21, 2022

    @stale

    This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  10. skyfaller commented on Dec 21, 2022

    @skyfaller
    Author

    I'll think of something productive to say next time stale bot rolls around. Right now I'm visiting my family for the solstice.

    Happy holidays and a joyful new year to everyone, especially people working on gitui!

  11. skyfaller commented on Dec 24, 2022

    @skyfaller
    Author

    Wait, is stale bot not counting my last comment? Why is this still marked as dormant? Has stale bot become sentient enough to recognize that my last comment only contained holiday greetings?

  12. removed
    dormantMarked by stale bot on close
    on Dec 24, 2022
  13. stale commented on Aug 12, 2023

    @stale

    This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  14. skyfaller commented on Aug 16, 2023

    @skyfaller
    Author

    How are you doing? My phone randomly died, but I'm finally back online with a new one. It's a beautiful summer day, maybe I'll go for a bike ride tonight.

    Keep up the good work, and please don't mark this issue as stale!

  15. skyfaller commented on Aug 22, 2023

    @skyfaller
    Author

    I didn't make it out for a bike ride the other night, but here's an Eastern Tiger Swallowtail on a butterfly bush!

    PXL_20230727_165104583~2.jpg

    If stale bot likes butterfly pictures, I have more where that came from ;-)

    But seriously, what is going on here? Did stale bot level up so that it takes two posts to defeat it now?

  16. removed
    dormantMarked by stale bot on close
    on Aug 22, 2023
  17. stale commented on Mar 17, 2024

    @stale

    This issue has been automatically marked as stale because it has not had any activity half a year. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

  18. skyfaller commented on Mar 31, 2024

    @skyfaller
    Author

    I have nothing to report about git diff --color-moved, but today I saw a house finch up close for the first time in person. It landed on a bird feeder about five feet from my head, and I was able to appreciate its red plumage in detail.

    I'm really excited because goldfinches have nested in the trees across the street for the last couple of years, and the other day I heard and saw a goldfinch there again! Maybe we will soon welcome more tiny goldfinches to the neighborhood.

    Those colors sure are moving :-)

  19. skyfaller commented on Mar 31, 2024

    @skyfaller
    Author

    Aww man, are we still requiring the stale bot double-tap? Here's comment number two.

    I had to bike home in the rain today and got really grumpy, but then I thought about this sign I saw in my neighborhood last week.

    PXL_20240329_202641841.jpg

    What do you get when you get more rain? More rainbows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions