Git-Markdown-Typora操作问题解决方案记录

学习Markdown, Git, Typora第一天开始就出现很多操作上的问题,当时解决了后来又忘记。我想有必要把每次出现的问题记录一下。这篇文章将会持续更新。

从学习Markdown, Git, Typora第一天开始就出现很多操作上的问题,当时解决了后来又忘记。我想有必要把每次出现的问题记录一下。持续更新中。。。。

一. Git

Git图解:

  • Workspace:工作区
  • Index / Stage:暂存区
  • Repository:仓库区(或本地仓库)
  • Remote:远程仓库

1. diverged

1
2
3
# Your branch and 'origin/master' have diverged,
# and have 3 and 8 different commits each, respectively.
# (use "git pull" to merge the remote branch into yours)

方法是:

1
2
git fetch origin
git reset --hard origin/master

还没有搞懂什么意思,结果是删除了工作区新的文件,恢复到到了之前的状态,状态正常。

2.Changes to be committed

1
2
3
4
5
6
7
8
9
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

deleted: EXE文件/EvenRuiDict/EvenRuiDictionaryv1.0DeveloperSonicHuang.exe
deleted: EXE文件/downloadcatpicture/CatPicDownloadv1.0DeveloperSonicHuang.exe

情况:这两个文件我改了名字重新提交了,但是提示缓存区有被删除的文件

解决方法:后来明白,本地进行的删除操作也要经过add, commit, push这个程序才能把所有记录和远程上的文件删除

1
2
3
$ git add EXE文件/EvenRuiDict/EvenRuiDictionaryv1.0DeveloperSonicHuang.exe
$ git commit -m '删除EvenRuiDictionaryv1.0DeveloperSonicHuang.exe'
$ git push
1
2
3
4
5
6
7
8
9
10
11
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)

deleted: EXE文件/downloadcatpicture/CatPicDownloadv1.0DeveloperSonicHuang.exe

no changes added to commit (use "git add" and/or "git commit -a")

可以看到第一个文件已经被删除了。第二个文件通过同样的方法删除掉。

参考Git删除文件

总结:凡是在本地删除文件都要提交删除操作,才能使所有本地和远程保持一致

3. LF will be replaced by CRLF

1
2
warning: LF will be replaced by CRLF in 通讯录.py.
The file will have its original line endings in your working directory.

出现上述问题是在通讯录.py中使用了回车换行CRLF,而git是LF。表示在远端仓库保持了CRLF, 但是我的py文件都是回车换行,为什么只有这个文件有提示呢?搞不懂

参考:

CRLF和LF在跨平台工作时候带来的烦恼以及解决方法

Git中的“LF will be replaced by CRLF”警告详解

4. 在命令行出现<符号

1
2
3
4
5
6
7
8
vulcanten@vulcanten-pc MINGW32 /e/python files/IDEL FILES/My py file (master)
$ git commit -m 'add 爬虫-词条副标题.py
> ^C

vulcanten@vulcanten-pc MINGW32 /e/python files/IDEL FILES/My py file (master)
$ git commit -m 'add 爬虫-词条副标题.py
> bash: unexpected EOF while looking for matching `''
bash: syntax error: unexpected end of file

如上当输入不完整,双引号,单引号没有闭合就会出现另起一行并出现<符号,这是可以用Ctr+c, 或者Ctr+d退出输入

二. Markdown(记录Typora不能表达的情况)

1. 在段落中插入一小段代码,使用英文输入法反引号(~键)引用

例如:Python的print()

2.

三. Typora

1.查看markdown源代码

在typora编辑器左下角可以查看

2.退回上一步编辑