注意:需要在上面提到的config.json目录C:\Users\{username}\.picgo中执行,不然后面.\picgo.exe set uploader无法选择minio。
2023年3月1日笔者再次使用时发现,以上命令报错会报错:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
C:\Users\fusionshen\.picgo>C:\Users\fusionshen\AppData\Roaming\Typora\picgo\win64\picgo.exe install picgo-plugin-minio npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/picgo-plugin-picgo-plugin-minio - Not found npm ERR! 404 npm ERR! 404 'picgo-plugin-picgo-plugin-minio@*' is not in this registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\fusionshen\AppData\Local\npm-cache\_logs\2023-03-01T02_39_55_325Z-debug-0.log (node:9132) UnhandledPromiseRejectionWarning: #<Object> (node:9132) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:9132) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
PS C:\WINDOWS\system32> cd C:\Users\{username}\AppData\Roaming\Typora\picgo\win64\ PS C:\Users\{username}\AppData\Roaming\Typora\picgo\win64> .\picgo.exe set uploader ? Choose a(n) uploader imgur aliyun upyun > minio smms tcyun github (Move up and down to reveal more choices)
当执行 git checkout HEAD . 或者 git checkout HEAD <file> 命令时,会用 HEAD 指向的 master 分支中的全部或者部分文件替换暂存区和以及工作区中的文件。这个命令也是极具危险性的,因为不但会清除工作区中未提交的改动,也会清除暂存区中未提交的改动。
3.4 Git工作目录下文件的五种状态
Git工作目录下的文件存在五种状态:
untracked 未跟踪(未被纳入版本控制)
tracked 已跟踪(被纳入版本控制)
unmodified 未修改状态
modified 已修改状态
staged 已暂存状态 这些文件的状态会随着我们执行Git的命令发生变化
3.5 本地仓库操作
git status 查看文件状态,也可以使用git status –s 使输出信息更加简洁
1 2 3 4 5 6 7 8 9 10 11 12 13 14
PS D:\test> git status On branch master Your branch is up to date with 'origin/master'.
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a") PS D:\test> git status -s M README.md PS D:\test>
git add 将未跟踪的文件加入暂存区 将新创建的文件加入暂存区后查看文件状态
1 2 3 4 5 6 7 8 9 10 11
PS D:\test> git add .\README.md PS D:\test> 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)
modified: README.md
PS D:\test>
git reset 将暂存区的文件取消暂存 将文件取消暂存后查看文件状态
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
PS D:\test> git reset .\README.md Unstaged changes after reset: M README.md PS D:\test> git status On branch master Your branch is up to date with 'origin/master'.
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md
no changes added to commit (use "git add" and/or "git commit -a") PS D:\test>
git commit 将暂存区的文件修改提交到本地仓库
1 2 3 4 5 6 7 8 9 10 11
PS D:\test> git add .\README.md PS D:\test> git commit -m"update Readme" .\README.md [master7ac056e] update Readme 1 file changed, 4 insertions(+) PS D:\test> git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
nothing to commit, working tree clean PS D:\test>
git rm 删除文件 删除文件后查看文件状态
1 2 3 4 5 6 7 8 9 10 11 12 13
PS D:\test> git rm .\README.md rm'README.md' PS D:\test> git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
Changes to be committed: (use "git reset HEAD <file>..." to unstage)
# no .a files *.a # but do track lib.a, even though you're ignoring .a files above !lib.a # only ignore the TODO file in the current directory, not subdir/TODO /TODO # ignore all files in the build/ directory build/ # ignore doc/notes.txt, but not doc/server/arch.txt doc/*.txt # ignore all .pdf files in the doc/ directory doc/**/*.pdf
PS D:\minhang\testGit> git banch -r git: 'banch' is not a git command. See 'git --help'.
The most similar command is branch PS D:\minhang\testGit> git branch -r origin/master PS D:\minhang\testGit> git branch -a dev master * stage remotes/origin/master PS D:\minhang\testGit>
创建分支
1 2 3 4 5 6 7 8 9 10 11 12
PS D:\minhang\testGit> git branch * master PS D:\minhang\testGit> git branch dev PS D:\minhang\testGit> git branch dev * master PS D:\minhang\testGit> git checkout -b stage Switched to a new branch 'stage' PS D:\minhang\testGit> git branch dev master * stage
切换分支
1 2 3 4 5 6 7 8 9 10 11 12 13
PS D:\minhang\testGit> git branch -a dev master * stage remotes/origin/master PS D:\minhang\testGit> git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. PS D:\minhang\testGit> git branch dev * master stage PS D:\minhang\testGit>
推送至远程仓库分支
1 2 3 4 5 6 7 8
PS D:\minhang\testGit> git push origin dev Total 0 (delta 0), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-5.0] remote: Create a pull request for'dev' on Gitee by visiting: remote: https://gitee.com/fusionshen/test/pull/new/fusionshen:dev...fusionshen:master To https://gitee.com/fusionshen/test.git * [newbranch] dev -> dev PS D:\minhang\testGit>
PS D:\minhang\testGit> git status On branch dev (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
modified: README.md no changes added to commit (use "git add" and/or "git commit -a") PS D:\minhang\testGit> git add . PS D:\minhang\testGit> git commit -m"测试分支合并" [devacff4ab] 测试分支合并 1 file changed, 2 insertions(+), 1 deletion(-) PS D:\minhang\testGit> git push origin dev Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 320 bytes | 320.00 KiB/s, done. Total 3 (delta 2), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-5.0] To https://gitee.com/fusionshen/test.git f5d3192..acff4ab dev -> dev PS D:\minhang\testGit> git checkout master Switched to branch 'master' Your branch is up to date with 'origin/master'. PS D:\minhang\testGit> git merge dev Updating f5d3192..acff4ab Fast-forward README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) PS D:\minhang\testGit> git status On branch master Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits)
nothing to commit, working tree clean PS D:\minhang\testGit>
$ git switch master Switched to branch 'master' Your branch is ahead of 'origin/master' by 6 commits. (use "git push" to publish your local commits) $ git merge --no-ff -m "merged bug fix 101" issue-101 Merge made by the 'recursive' strategy. readme.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
现在,是时候接着回到dev分支干活了!
1 2 3 4 5 6
$ git switch dev Switched to branch 'dev'
$ git status On branch dev nothing to commit, working tree clean
工作区是干净的,刚才的工作现场存到哪去了?用git stash list命令看看:
1 2
$ git stash list stash@{0}: WIP on dev: f52c633 add merge
$ git stash pop On branch dev Changes to be committed: (use "git reset HEAD <file>..." to unstage)
new file: hello.py
Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory)
建议不要跨操作系统使用文件,除非有这么做的特定原因。 若想获得最快的性能速度,请将文件存储在 WSL 文件系统中,前提是在 Linux 命令行(Ubuntu、OpenSUSE 等)中工作。 如果使用 Windows 命令行(PowerShell、命令提示符)工作,请将文件存储在 Windows 文件系统中。
例如,在存储 WSL 项目文件时:
使用 Linux 文件系统根目录:\\wsl$\Ubuntu-18.04\home\<user name>\Project
还可以在 WSL 的 Linux 终端中使用 Windows 命令。 尝试打开 Linux 分发版(即 Ubuntu),通过输入以下命令确保你位于 Linux 主目录中:cd ~。 然后通过输入 powershell.exe /c start .(不要忘记尾部的句点),在文件资源管理器中打开 Linux 文件系统。
WSL 2 仅适用于 Windows 10 版本 1903、内部版本 18362 或更高版本。 通过按 Windows 徽标键 + R,检查你的 Windows 版本,然后键入 winver,选择“确定”。 (或者在 Windows 命令提示符下输入 ver 命令)。 你可能需要更新到最新的 Windows 版本。 低于 18362 的版本根本不支持 WSL。
WSL 2 是对基础体系结构的一次重大改造,它使用虚拟化技术和 Linux 内核来实现其新功能。 此更新的主要目标是提高文件系统性能和添加完全的系统调用兼容性。
2.2.3.1 WSL 2 体系结构
传统的 VM 体验可能启动速度慢,是独立的,消耗大量资源,需要你花费时间进行管理。 WSL 2 没有这些属性。
WSL 2 有 WSL 1 的优点,包括 Windows 和 Linux 之间的无缝集成,启动时间短,资源占用量少,并且无需 VM 配置或管理。 虽然 WSL 2 确实使用 VM,但 VM 是在幕后管理和运行的,因此你将具有与 WSL 1 相同的用户体验。
2.2.3.2 完整的 Linux 内核
WSL 2 中的 Linux 内核是 Microsoft 根据最新的稳定版分支(基于 kernel.org 上提供的源代码)构建的。此内核已专门针对 WSL 2 进行了调整,针对大小和性能进行了优化,以便在 Windows 上提供良好的 Linux 体验。 内核将由 Windows 更新提供服务,这意味着你将获得最新的安全修补程序和内核改进功能,而无需自行管理它。
请考虑尝试 VS Code 远程 WSL 扩展,以便使你不仅能够使用 Linux 命令行工具将项目文件存储在 Linux 文件系统上,而且还可以使用 Windows 上的 VS Code 在 Internet 浏览器中创作、编辑、调试或运行项目,而不会造成任何与跨 Linux 和 Windows 文件系统工作相关联的性能下降。 了解详细信息
2.2.5 访问网络应用程序
2.2.5.1 从 Windows (localhost) 访问 Linux 网络应用
如果要在 Linux 分发版中构建网络应用(例如,在 NodeJS 或 SQL server 上运行的应用),可以使用 localhost 从 Windows 应用(如 Microsoft Edge 或 Chrome Internet 浏览器)访问它(就像往常一样)。
但是,如果运行的是较旧版本的 Windows(版本 18945 或更低版本),则需要获取 Linux 主机 VM 的 IP 地址(或更新到最新的 Windows 版本)。
Windows 终端可启用多个选项卡(在多个 Linux 命令行、Windows 命令提示符、PowerShell 和 Azure CLI 等之间快速切换)、创建键绑定(用于打开或关闭选项卡、复制粘贴等的快捷方式键)、使用搜索功能,以及使用自定义主题(配色方案、字体样式和大小、背景图像/模糊/透明度)。 了解详细信息。
echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted deb http://mirrors.aliyun.com/ubuntu/ focal universe deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe deb http://mirrors.aliyun.com/ubuntu/ focal multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted deb http://mirrors.aliyun.com/ubuntu/ focal-security universe deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse" > /etc/apt/sources.list