Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abossi/diffRgit
Create an HTML git diff widget using the diff2html library
https://github.com/abossi/diffRgit
Last synced: 3 months ago
JSON representation
Create an HTML git diff widget using the diff2html library
- Host: GitHub
- URL: https://github.com/abossi/diffRgit
- Owner: abossi
- Created: 2017-03-19T10:37:46.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-20T17:18:24.000Z (over 7 years ago)
- Last Synced: 2024-01-28T23:08:15.168Z (9 months ago)
- Language: R
- Size: 106 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-shiny-extensions - diffRgit - Create an HTML git diff widget using the diff2html library. (UI Components / Code Diff)
README
# DiffRgit
Create an HTML git diff widget using the diff2html library.
[![N|Solid](https://cldup.com/dTxpPi9lDf.thumb.png)](https://codepen.io/salc2/pen/gwdxrB)
### Installation
Install the dependencies:
```sh
> require(devtools)
> install_github("abossi/diffRgit")
```### Exemple
```sh
> l_diff <- "diff --git a/../diff2widget/file1 b/../diff2widget/file2\nindex ab63d51..eb01961 100644\n--- a/../diff2widget/file1\n+++ b/../diff2widget/file2\n@@ -1,5 +1,4 @@\n-hello!\n+hello world!\n Where is Bryan?\n+Bryan is in the kitchen.\n bye!\n-\n-oups!"> diffRgit(l_diff)
```result:
![view.png](view.png)
### Diff format
To generate the string 'l_diff', you can use:
```sh
> l_diff <- system("git diff [file1]")
> l_diff <- paste0(l_diff, collapse='\n')
> diffRgit(l_diff)
```to compare current file with the last commit.
```sh
> l_diff <- system("git diff [SHA] -- [file1]")
> l_diff <- paste0(l_diff, collapse='\n')
> diffRgit(l_diff)
```to compare current file with the [SHA] commit.
```sh
> l_diff <- system("git diff [SHA1] [SHA2] [file1]")
> l_diff <- paste0(l_diff, collapse='\n')
> diffRgit(l_diff)
```to compare current 2 commits.
```sh
> l_diff <- system("diff -u [file1] [file2]")
> l_diff <- paste0(l_diff, collapse='\n')
> diffRgit(l_diff)
```if you don't use git and you realy whant use this widget!
### License
License GPL3