I've seen people show diffs of their code from other forks to illustrate a point in github like on this pull request thread: https://github.com/osTicket/osTicket/pull/3035
I think it would be really helpful to show the diff of the commit from the current branch. How do you do it?
On the Github, go to the Source view of your project. You will see a link named 'Branch List'. Once the page opens you can see a list of all the remote branches. Hit on the Compare button in front of any of the available branches to see the difference between two branches.
You can run the git diff HEAD command to compare the both staged and unstaged changes with your last commit. You can also run the git diff <branch_name1> <branch_name2> command to compare the changes from the first branch with changes from the second branch. Order does matter when you're comparing branches.
When viewing a combined diff, if the two files you're comparing have a line that's different from what they were merged into, you will see the ++ to represent: one line that was added does not appear in either file1 or file2.
Diff command is used in git to track the difference between the changes made on a file. Since Git is a version control system, tracking changes are something very vital to it. Diff command takes two inputs and reflects the differences between them. It is not necessary that these inputs are files only.
Here's an example of a comparison between two tags. You can also compare two arbitrary commits in your repository or its forks on GitHub in a two-dot diff comparison. To quickly compare two commits or Git Object IDs (OIDs) directly with each other in a two-dot diff comparison on GitHub, edit the URL of your repository's "Comparing changes" page.
So what git diff actually shows you all the changes done in the file after doing a commit for example:- a file say at.txt is modified here after doing a commit and here we can see that there is a difference in the file after a commit. Illustration: Changes between two Commits as shown below as follows:
You can pull the branch to your local copy, and make your modification. After that, copy the output of git diff and paste to GitHub as follows. Thank you. This is close but doesn't seem to color-code it the way that the examples do.
Here is how you can view the differences in commits: On the Github, go to the Source view of your project. You will see a link named ‘Branch List’. Once the page opens you can see a list of all the remote branches.
You can pull the branch to your local copy, and make your modification. After that, copy the output of git diff
and paste to GitHub as follows.
```diff your diff file contents ```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With