```{r echo=FALSE, message=FALSE, warning=FALSE}
source(here::here("R/load.R"))
```


# Git 安装

```{r,child="../analysis/git-base/install-git.Rmd"}
```


# clone 第一个项目

```{r,child="../analysis/git-base/git-clone.Rmd"}
```




# 批量上传

```{r,child="../analysis/git-base/batch-uploads.Rmd"}
```




# Git

```{r,child="../analysis/git.Rmd"}
```



## loose object is corrupt

```{r,child="../analysis/git-base/fatal-corrupt.Rmd"}
```

## How to fix a corrupt git index

```{r,child="../analysis/git-base/corrupt_git_index.Rmd"}
```

## unable to create file Invalid argument

```{r,child="../analysis/git-base/unable_to_create_file_invalid_argument.Rmd"}
```

## merge some commit

```{r,child="../analysis/github/merge-some-commit.Rmd"}
```

## 查询一个文件所有 commit 和明细

这种问题还是看 `git` 而非 `git2r`，太乱。

参考 https://www.atlassian.com/git/tutorials/git-log

加上`--stat`，不要`-p`，会看到内容上的修改，乱七八糟的。
最好还可以看到修改的文档！这样就全面了！

```bash
$ git log --stat LICENSE | clip
commit 7c24e5f666029b7464099f7ea3367ee956844bf2
Author: Jiaxiang Li <alex.lijiaxiang@foxmail.com>
Date:   Sun Jan 26 23:18:49 2020 +0800

    * Update the year of the LICENSE.
    * Remove empty files.
    * Make some addins not exported.
    * Add 'allow_non_interactive = TRUE' to some functions with 'clipr::write_clip' function.
    * Make some functions with 'donttest' in the examples.
    * Add examples into functions.
    * Add arguements into functions.

 LICENSE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit a65d99e9420476ce56bb550d95c80b49746d368b
Author: Jiaxiang Li <alex.lijiaxiang@foxmail.com>
Date:   Mon Sep 9 18:01:49 2019 +0800

    update license.

 LICENSE | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

commit 3be53ec5c365a9863f48fe4c9f43da035b2275b0
Author: Jiaxiang Li <alex.lijiaxiang@foxmail.com>
Date:   Thu Nov 15 12:57:17 2018 +0800

    update readme

 LICENSE | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)

commit 011a78997d06e81acc23667d4b1fd14517202c8e
Author: Jiaxiang Li <jli270@binghamton.edu>
Date:   Thu Nov 15 11:19:38 2018 +0800

    Initial commit

 LICENSE | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
```

one line 情况

```{r,child="../analysis/git-base/pretty-log.Rmd"}
```


## 最近 log 记录

```{r,child="../analysis/git-base/whatchanged.Rmd"}
```


## 更好的建项目方式

```r
dir.create("../dtmvisual")
git2r::clone("https://github.com/GSukr/dtmvisual.git", "../dtmvisual")
```

这样不方便，还不如直接 `git clone`

## 重新设置 release

```{r,child="../analysis/git-base/reset-upstream.Rmd"}
```
## 提取文档做解释

方便 document。

```r
git2r::status() %>% unlist() %>% 
    paste0("1. `",.,"`") %>% 
    clipr::write_clip()
```

## 解释表格的变量 

因为方便写 github 和 gitlab

```r
df %>% names() %>% 
    paste0("1. `", ., "` ") %>% 
    clipr::write_clip()
```

## 查询文档的贡献者

```{r,child="../analysis/git-base/blame.Rmd"}
```

## 查询 ignored 文件

```{r,child="../analysis/git-base/status-ignored.Rmd"}
```

## diff-tree

```{r,child="../analysis/git-base/diff-tree.Rmd"}
```

## git rebase --continue

```{r,child="../analysis/git-base/git_rebase_continue.Rmd"}
```

## git fetch

```bash
$ git fetch https
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 5 (delta 2), reused 4 (delta 2), pack-reused 0
Unpacking objects: 100% (5/5), done.
From https://github.com/liangzp/2020-Tencent-adAlgo
 * [new branch]      master          -> https/master
 * [new branch]      series-circuits -> https/series-circuits
 * [new branch]      tandem_y        -> https/tandem_y
 * [new branch]      write-commit    -> https/write-commit
 * [new branch]      zhipeng         -> https/zhipeng
```
 
fetch 的意义。

```bash
$ git checkout tandem_y
Switched to a new branch 'tandem_y'
Branch 'tandem_y' set up to track remote branch 'tandem_y' from 'https'.
```

## push all

参考 https://matthiasloibl.com/posts/git-push-all-branches/

```bash
$ git push --all https
Enumerating objects: 17, done.
Counting objects: 100% (14/14), done.
Delta compression using up to 4 threads
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 5.61 KiB | 1.87 MiB/s, done.
Total 9 (delta 6), reused 0 (delta 0)
remote: Resolving deltas: 100% (6/6), completed with 3 local objects.
To https://github.com/JiaxiangBU/rumor_detection_2019_ncov.git
   f9eb174..821d4fd  master -> master
 * [new branch]      multi-domain -> multi-domain
 * [new branch]      multi-domain02 -> multi-domain02
```
 




## cherry-pick

```{r,child="../analysis/cherry-pick.Rmd"}
```


## create a new git branch from an old commit

```{r,child="../analysis/git-base/create-a-new-git-branch-from-an-old-commit.Rmd"}
```

## 全删全增处理

```{r,child="../analysis/git-base/total-changes.Rmd"}
```




## 解决合并冲突 {#merge-conflict}

```{r,child="../analysis/git-base/merge-conflict.Rmd"}
```




## 对比两个分支差异

```{r,child="../analysis/git-base/showing-which-files-have-changed-between-two-revisions.Rmd"}
```

## 从一个分支复制文件

```{r,child="../analysis/git-base/copy-files-between-git-branches.Rmd"}
```

## 回滚某个文件

参考 https://zhuanlan.zhihu.com/p/84843029

```
$ git checkout 3bb64166 -- commit.Rmd
```

## git pull origin

```{r,child="../analysis/git-base/git-pull-origin.Rmd"}
```

```{r include=FALSE}
rest_list <- 
c(here::here("analysis/git-base/avoid-filename-with-capitalization.Rmd"),
  here::here("analysis/git-base/can-t-push-to-remote-branch-cannot-be-resolved-to-branch.Rmd"),
  here::here("analysis/git-base/callback-filename.Rmd"),
  here::here("analysis/git-base/diff-filter.Rmd"),
  here::here("analysis/git-base/fatal-ambiguous-argument-branch-name-both-revision-and-filename.Rmd"),
  here::here("analysis/git-base/grep-branch-name.Rmd"),
  here::here("analysis/git-base/using-git-how-could-i-search-for-a-string-across-all-branches.Rmd"),
  here::here("analysis/git-base/how-do-i-delete-a-git-branch-locally-and-remotely.Rmd"),
  here::here("analysis/git-base/how-to-pull-remote-branch-from-somebody-elses-repo.Rmd"),
  here::here("analysis/git-base/ls-remote.Rmd"),
  here::here("analysis/git-base/push-with-enumerating-objects-24-done.Rmd"),
  here::here("analysis/git-base/three-branch-rule.Rmd"),
  here::here("analysis/use-git-on-server.Rmd")
  )
```

```{r,child=rest_list}

```



# GitHub


## 使用 Milestone

```{r,child="../analysis/github/use-milestone.Rmd"}
```

## 数据安全

```{r,child="../analysis/github/data-security.Rmd"}
```



## 使用 Project Board

之后的汇报直接见项目看板，

1. 这样不需要花时间整理
1. 不需要把汇报内容托管在某一个具体项目下，如`creditRating`，这样更加偏 sense，汇报是一个独立的东西，不应当归属于任何一个具体项目

```{r,child="../analysis/github/use-github-board.Rmd"}
```

```{r,child="../analysis/github/use-filter-cards.Rmd"}
```

### 看板的列

```{r,child="../analysis/github/cols-in-project-board.Rmd"}
```


## 解决GitHub访问慢方案

```{r,child="../analysis/github/quick-visit.Rmd"}
```



## 稍后阅读

```{r,child="../analysis/github/saved-for-later.Rmd"}
```



## Private Contributions

```{r,child="../analysis/private_contributions.Rmd"}
```



## GitHub 主页

```{r,child="../analysis/github/release_info.Rmd"}
```



## rpostback-askpass

```{r,child="../analysis/github/rpostback-askpass.Rmd"}
```

## 使用 GitHub API

```{r,child="../analysis/github/use-api.Rmd"}
```

## 下载部分文件

```{r,child="../analysis/github/the_remote_end_hung_up_unexpectedly.Rmd"}
```

## close issue

如果 issue 不 close 那么就会在 github.com *Recent activity* 这一块挡住。

## 方便复制粘贴到 issue comment

```bash
$ jupyter nbconvert jinxiaosong/if-else.ipynb --to markdown
[NbConvertApp] Converting notebook jinxiaosong/if-else.ipynb to markdown
[NbConvertApp] Writing 3175 bytes to jinxiaosong\if-else.md
```

`cat`的使用参考
https://jiaxiangli.netlify.com/2018/01/04/shell/

```bash
$ cat jinxiaosong/if-else.md | clip
```

但是中文会乱码。

```r
read_lines("../tutoring2/jinxiaosong/if-else.md") %>% clipr::write_clip()
append_comments_to_issue("https://github.com/JiaxiangBU/tutoring2/issues/30")
```

## 整理 issue 的 todos

`sort_todo_by_df()`
我想起来，现在 `- [ ]` 也可以用来整理 github issue哈哈！

## 如何通过邮件回复

```{r, echo=FALSE}
knitr::include_graphics("../figure/github_reply_via_email.png")
```

直接根据提醒的邮件回复。

## Security Alerts

参考 https://help.github.com/en/github/managing-security-vulnerabilities/configuring-automated-security-updates

```{r, echo=FALSE}
knitr::include_graphics("../figure/20200226212541.png")
```

参考 https://github.com/JiaxiangBU/dynamic_topic_modeling/pull/1
GitHub 会自动产生一个 Pull Request，直接 merge 好了。


## 传大文件


大文件传 release，超过50MB检验不传项目。 因为这样其他人 clone 和 pull 的时候才耗时少。

## 修改`.Renviron`

记得重启 R 才能生效。

## 无法创建 issue

```bash
> create_issue("xxx")
i The issue is located 'https:/github.com/JiaxiangBU/xxx/issues/59'
```


```bash
$ gh issue status
Post https://api.github.com/graphql: read tcp xxx->xxx: wsarecv: An existi
ng connection was forcibly closed by the remote host.
```
`gh::gh` 走 v3 `gh` 走 v4 都不稳定老是报错，多刷几次就好了。

## 对长评论进行截图

1. 先把 comment 的 markdown 格式拿下来，这个可以直接点击 comment 的右键 edit 拿到。
    这里可以用 `add2gh::collect_comments()`拿到
1. 然后在 RStudio 内新建一个 RMarkdown 文档，knit 为 html 文档。
1. 用 `webshot::webshot` 进行截图即可。

## Permalink

(ref:permalink-plot) 注意要实现这样的代码，文档必须在同一个项目。不会出现那样的代码框，而只是超链接。

参考 [GitHub Help](https://help.github.com/en/github/managing-your-work-on-github/creating-a-permanent-link-to-a-code-snippet)

```{r permalink-plot, fig.cap='(ref:permalink-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200322233943.jpg")
```

## Sourcegraph 下载 PDF

(ref:sourcegraph-plot) 下载 pdf 很方便

```{r sourcegraph-plot, fig.cap='(ref:sourcegraph-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200317173753.png")
```

## comment 拖动对话框

(ref:20200426142702-plot) 拖动对话框可以帮助在文字很多的时候进行编辑。

```{r 20200426142702-plot, echo=FALSE, fig.cap='(ref:20200426142702-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200426020158.png")
```

## Pull Request

参考 https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-request-reviews

> Reviews allow collaborators to 
> 
> 1. comment on the changes proposed in pull requests,
> 1. approve the changes, or
> 1. request further changes before the pull request is merged.
> 1. Repository administrators can require that all pull requests are approved before being merged.


这是 pull request 的四个作用。

> You can resolve a conversation in a pull request if you opened the pull request or if you have write access to the repository where the pull request was opened.

Resolving conversations 指的是讨论解决了问题，一般 pull request 提交者和 conversation 提交者有权限关闭。

> If the suggestion in a comment is out of your pull request's scope, you can open a new issue that tracks the feedback and links back to the original comment.

当讨论的问题和 pull request 或者 issue 不相关时，可以点击右上方，重新提交一个新的 issue，参考 https://help.github.com/en/github/managing-your-work-on-github/opening-an-issue-from-a-comment

## 如何书写 Pull Request Review

参考 https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/reviewing-proposed-changes-in-a-pull-request
这里包含了 suggestion 等情况。


## table md

```{r,child="../analysis/github/table-md.Rmd"}
```



## gh-pages branch

```{r,child="../analysis/github/gh-pages.Rmd"}
```




## 查询 branch 的关系

如 https://github.com/JiaxiangBU/xxx-xxx/network
可以查看，方便 merge 和 diff


## 转移 issue

```{r,child="../analysis/github/transferring-an-issue-to-another-repository.Rmd"}
```


# GitHub cli

## 安装

从 release 页面安装
https://github.com/cli/cli/releases/tag/v0.5.7
这点可以加入到 learn_git

## 设置环境变量

没有配置环境变量。

```{r eval=FALSE}
fs::dir_tree(here::here("../../install/gh_cli"))
```

没有` bin\`，设置环境变量
`D:\install\gh_cli\`
设置以后就好了。

## 配置


```bash
$ gh issue list
Notice: authentication required
Press Enter to open github.com in your browser...
```

1. 创建 token
1. 顺手更新，使用`usethis::edit_r_environ()`

```bash
nano ~/.config/gh/config.yml
```

```bash
github.com:
  - user: JiaxiangBU
    oauth_token: 
```


## wsarecv error

```bash
$  gh issue list
Post https://api.github.com/graphql: read tcp xxx->xxx: wsarecv: An existing connection was forcibly closed by the remote host.
```
参考 https://github.com/cli/cli/issues/536
https://github.com/cli/cli/issues/286
这是同样的问题，一会就会消失，目前没有好的解决方法。

## 查看 issue list

参考 https://cli.github.com/manual/

```bash
$ gh issue status
Relevant issues in JiaxiangBU/tutoring2

Issues assigned to you
  #35 code reproduction <https://lexparsimon.github.io/coronavirus/>  (bug) about 2 days ago
  #34 Error in `[.data.frame`(obj, ii, j, drop = FALSE) : undefined colum...  (bug) about 2 days ago
  #1 here::here 浣跨敤  (documentation, good first issue) about 6 months ago

Issues mentioning you
  There are no issues mentioning you

Issues opened by you
  #35 code reproduction <https://lexparsimon.github.io/coronavirus/>  (bug) about 2 days ago
  #8 plan: 鍏抽棴椤圭洰 about 5 months ago
  #7 swap analysis about 5 months ago
  #6 NLP XGBoost 涓嶉€傚簲鐨勬儏鍐?about 5 months ago
  #5 Python for 寰幆 about 5 months ago
  #1 here::here 浣跨敤  (documentation, good first issue) about 6 months ago
```



## 查看 issue 内容

以项目 tutoing2 为例

```bash
$ gh issue view 35 --preview | clip
code reproduction <https://lexparsimon.github.io/coronavirus/>
opened by JiaxiangBU. 2 comments. (bug)



    $ jupyter nbconvert --to markdown wuruiqi/coronavirus.ipynb
    [NbConvertApp] Converting notebook wuruiqi/coronavirus.ipynb to markdown
    [NbConvertApp] Writing 3648 bytes to wuruiqi\coronavirus.md

   wuruiqi/coronavirus.ipynb  这是复现的 notebook，我 reformat 了代码。

    import numpy as np

    # initialize the population vector from the origin-destination flow matrix
    N_k = np.abs(np.diagonal(OD) + OD.sum(axis=0) - OD.sum(axis=1))
    locs_len = len(N_k)  # number of locations
    SIR = np.zeros(
        shape=(locs_len, 3)
    )  # make a numpy array with 3 columns for keeping track of the S, I, R
  groups
    SIR[:, 0] = N_k  # initialize the S group with the respective populations

    first_infections = np.where(
        SIR[:, 0] <= thresh, SIR[:, 0] // 20, 0
    )  # for demo purposes, randomly introduce infections
    SIR[:, 0] = SIR[:, 0] - first_infections
    SIR[:, 1] = SIR[:, 1] + first_infections  # move infections to the I group

    # row normalize the SIR matrix for keeping track of group proportions
    row_sums = SIR.sum(axis=1)
    SIR_n = SIR / row_sums[:, np.newaxis]

    # initialize parameters
    beta = 1.6
    gamma = 0.04
    public_trans = 0.5  # alpha
    R0 = beta / gamma
    beta_vec = np.random.gamma(1.6, 2, locs_len)
    gamma_vec = np.full(locs_len, gamma)
    public_trans_vec = np.full(locs_len, public_trans)

    # make copy of the SIR matrices
    SIR_sim = SIR.copy()
    SIR_nsim = SIR_n.copy()

    # run model
    print(SIR_sim.sum(axis=0).sum() == N_k.sum())
    from tqdm import tqdm_notebook

    infected_pop_norm = []
    susceptible_pop_norm = []
    recovered_pop_norm = []

    ---------------------------------------------------------------------------

    NameError                                 Traceback (most recent call last)

    <ipython-input-7-aa271ab2f1eb> in <module>
          2
          3 # initialize the population vector from the origin-destination flow
  matrix
    ----> 4 N_k = np.abs(np.diagonal(OD) + OD.sum(axis=0) - OD.sum(axis=1))
          5 locs_len = len(N_k)  # number of locations
          6 SIR = np.zeros(


    NameError: name 'OD' is not defined

  │ For this analysis, we will use the aggregated \(OD\) flow matrix of a
  │ typical day obtained from GPS data provided by local ride sharing
  │ company gg as a proxy for the mobility patterns in Yerevan city.

  这是 OD 的定义。 需要在 https://www.ggtaxi.com/signin 下载。

  │ Next, we need the population counts in each 250×250 m grid cell, which
  │ we approximate by proportionally scaling the extracted flow counts so
  │ that the total inflows in different locations sum up to approximately
  │ half of Yerevan’s population of 1.1 million. This is actually a bold
  │ assumption, but since varying this portion yielded very similar
  │ results, we will stick to it.

  然后下载后的数据做一个计数矩阵，进行标准化处理即可。
  这部分你可以把数据下载下来后，我这边处理。



View this issue on GitHub: https://github.com/JiaxiangBU/tutoring2/issues/35
````

## 查看 issue 任务安排情况

参考 https://github.com/cli/cli/issues/593

这个 issue 可以知道目前 issue 的 assign 情况。

```bash
$ gh issue list -a JiaxiangBU

Issues for JiaxiangBU/tutoring2

#38  文本相似比较                                             (good first issue)
#35  code reproduction <https://lexparsimon.github.io/cor...  (bug)
#1   here::here 使用                                          (documentation, good first issue)


A new release of gh is available: 0.6.0 → v0.6.1
https://github.com/cli/cli/releases/tag/v0.6.1
```

# GitLab

## 权限管理

```{r,child="../analysis/gitlab/working_with_user_permissions.Rmd"}
```


<!-- gitlab collection -->
o
```{r,child="../analysis/gitlab.Rmd"}
```

## 上传文件的小例子

```{r,child="../analysis/gitlab/upload-files.Rmd"}
# here::here("analysis/gitlab/upload-files.Rmd")
```

## 协同开发的注意事项

```{r,child="../analysis/gitlab/collaborative-dev.Rmd"}
```




## 设置 SSH 钥匙

```{r,child=c("../analysis/github/generate-ssh-keys.Rmd","../analysis/git-base/git-ssh-passphrase.Rmd")}
```

## REMOTE HOST IDENTIFICATION HAS CHANGED

```{r,child="../analysis/git-base/remote_host_identification_has_changed.Rmd"}
```

## 定期清理 SSH 和 access token

(ref:20200407163122-plot) revoke 所有的 GitHub Personal access tokens

```{r 20200407163122-plot, echo=FALSE, fig.cap='(ref:20200407163122-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200407163040.png")
```

这样才安全。

(ref:20200407163244-plot) Gitee 也是，所有的 SSH keys 都控制好。

```{r 20200407163244-plot, echo=FALSE, fig.cap='(ref:20200407163244-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200407163237.png")
```

(ref:20200407163545-plot) GitLab 也是，所有的 SSH keys 都控制好。

```{r 20200407163545-plot, echo=FALSE, fig.cap='(ref:20200407163545-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200407163538.png")
```


## 点对点交流方式

```{r,child="../analysis/gitlab/point2point-discussion.Rmd"}
```

## 提醒注意

在正文 `@`人 是不提醒，放心使用，并且如果要让别人知道，在 comments 进行。

## 使用 blame 页面

可以查询一个文档的历史更新记录。

```{r, echo=FALSE}
include_graphics("../refs/use-blame-page.png")
```
o
## 保持文档的覆盖习惯

不需要新建文件，替换我的文件，以你更新的为准。这样你的commit会保留，这样我们最新的以你为准。
并且之后的修改记录都会保留，方便 review。

## 设定项目人员的权限

```{r, echo=FALSE}
include_graphics(here::here("refs/add_member-1.png"))
```

## Merge Request Minimal Example

```{r,child="../analysis/gitlab/merge_request-minimal_example.Rmd"}
```

## Merge Request 报错

```{r,child="../analysis/gitlab/merge_request-bugs.Rmd"}
```

## 提取 project 列表

```{r,child="../analysis/gitlab/project_list.Rmd"}
```

## 查看最近 issue 的进度

```{r,child="../analysis/gitlab/last_updated.Rmd"}
```

## python-gitlab

参考 https://python-gitlab.readthedocs.io/en/stable/install.html

```bash
pip install --upgrade python-gitlab
```



# Gitee

## 私有选择

![私有项目](https://user-images.githubusercontent.com/15884785/61995428-058cd780-b0bb-11e9-8a4b-ea02e38facf6.png)

## 可以手动同步 github 项目

![image](https://user-images.githubusercontent.com/15884785/62519934-17127400-b85f-11e9-9236-43ead904ca91.png)

```{r, echo=FALSE}
knitr::include_graphics("../figure/20200225154334.png")
```

```bash
$ git clone https://gitee.com/jiaxiangli/aRt.git
Cloning into 'aRt'...
remote: Enumerating objects: 357, done.
remote: Counting objects: 100% (357/357), done.
remote: Compressing objects: 100% (286/286), done.
remote: Total 357 (delta 63), reused 357 (delta 63)3 MiB/s
Receiving objects: 100% (357/357), 285.80 MiB | 4.37 MiB/s, done.
Resolving deltas: 100% (63/63), done.
Checking out files: 100% (256/256), done.
```

下载好了。

## 同步项目考虑 Gitee

我解释下原因，因为目前 GitHub 这个项目比较大，由于 GitHub 服务器挂在国外，所以慢，慢的太长，就掉了。
但是正常的 commit 可以的，只是一次性要下载全部才会出现这个问题。
因此我在国内的 Gitee 也同步每个 commit，思路就是从 gitee clone 下来，然后修改 push 的地址为 GitHub，这样就可以正常使用了。

## 权限管理

(ref:20200521165700-plot) Gitee 权限管理

```{r 20200521165700-plot, echo=FALSE, fig.cap='(ref:20200521165700-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200409214236.png")
```


# 使用 release

```{r,child="../analysis/gitee/release.Rmd"}
```


# 附录

## 使用 BFG 完成 Git 历史记录清理

```{r,child="../analysis/bfg/bfg.Rmd"}
```

### 当前路径删除大文件

```{r,child="../analysis/bfg/bfg_cd.Rmd"}
```

### 例子1

```{r,child="../analysis/bfg/bfg-example.Rmd"}
```

### 例子2

```{r,child="../analysis/bfg/bfg-example2.Rmd"}
```

## cheatsheets

<iframe src="https://jiaxiangbu.github.io/cheatsheets_print/refs/atlassian-git-cheatsheet.pdf" width="100%" height="800px"></iframe>


## 使用 RStudio Git 模块查看 commit 记录

我觉得比 GitHub 上的要更加清晰一些。

![点击历史](https://user-images.githubusercontent.com/15884785/61816762-9b3c2300-ae7f-11e9-8814-843c3faf98d0.png)

![查看每次提交的记录](https://user-images.githubusercontent.com/15884785/61816791-a8f1a880-ae7f-11e9-94eb-cf7eca812ce3.png)

这里每一个文件都可以查看。


## Fork link

```r
gitlink::ribbon_css("mylink.com", position = "left")
```

![fork的展示](https://user-images.githubusercontent.com/15884785/62086778-0461d300-b292-11e9-87f0-bc8af7bc8d11.png)

想一想什么地方可以用到？

- [x] 试试马里奥里面？

![实际例子 https://github.com/JiaxiangBU/nintendo_switch_mario](https://user-images.githubusercontent.com/15884785/62086964-9e298000-b292-11e9-9d75-a136340d80b9.png)

## id 出现 unknown 的情况

增加这一行就好，`use_git_config(user.name = "Jiaxiang Li", user.email = "alex.lijiaxiang@foxmail.com")`

## 局部更新

```{r,child="../analysis/update_inch_by_inch.Rmd"}
```

## 选择 git2r 

因为 push 稳定。

## RStudio 查看文件

(ref:20200712231706-plot) 查看同一文档的 commits

```{r 20200712231706-plot, echo=FALSE, fig.cap='(ref:20200712231706-plot)', echo=FALSE}
knitr::include_graphics("../figure/20200711003610.png")
```



# 参考文献 {-}