Why is github showing deleted lines from past commits in red?

Hello everyone.

In working through the Mixed Messages project, I’ve encountered an issue using Github.

After I have pushed several commits, when I view the code on Github, deleted lines appear highlighted in red, as below:

I’m wondering why they are showing if they aren’t in the latest pushed commit, and can I get rid of them? Looks really messy. :grimacing:

Thanks for any help!

What your viewing is a diff. It’s showing the difference between the last state and the current state and is useful for when you want to confirm the validity of a PR.

Red (with the minus symbol) is what was removed. Green with the + symbol is what was added.

1 Like

That’s what I thought, but what I was wondering was whether these diffs should remain viewable when I’m happy to discard them?

It’s hard to say without knowing what branch you’re on etc.
Usually if they show it could mean that you haven’t merged the given branch to main.

This is a pretty handy tutorial to learn about branching in a more visual way: https://learngitbranching.js.org/

1 Like

Thanks, I will read it.