VSCode自定义代码片段——git命令操作一个完整流程

Posted 浅香沉木

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了VSCode自定义代码片段——git命令操作一个完整流程相关的知识,希望对你有一定的参考价值。

git命令操作一个完整流程


	// git'command
	// 11  如何自定义用户代码片段:VSCode =》左下角设置 =》用户代码片段 =》 新建全局代码片段文件... =》自定义片段名称 =》编辑用户片段 =》ctrl+S 保存
	// git命令操作一个完整流程
	"Print to console": 
  "prefix": "git'command",
  "body": [
"$ git config --global user.name 'Link'  --设置github账号名称",
"$ git config --global user.email '1183234982@qq.com'  --设置github注册时的邮箱",
"$ mkdir my_repository  --当前目录生成一个文件夹",
"$ cd my_repository  --选中文件夹",
"$ git init  --初始化.git仓库管理文件",
"$ touch my_file.html  --当前目录下生成一个文件",
"$ vi my_file.html  --编辑文件",
"$ cat my_file.html  --查看文件内容",
"$ git status  --查看仓库状态",
"$ git add my_file.html  --添加文件到暂存区",
"$ git status  --查看仓库状态",
"$ git commit -m '新建的文件my_file.html'  --暂存区的文件都移动到本地git仓库并设置本次操作相关信息",
"$ git status  --查看仓库状态",
"$ git config --list  --查看配置列表(:q 结束此命令)",
"$ git clone https://github.com/wuying-05/my_repository.git  --把一个远程仓库克隆到本地",
"$ cd my_repository  --选中文件夹",
"$ git status  --查看仓库状态",
"$ git add others.txt  --添加文件到暂存区",
"$ git commit -m '提交others.txt'  --暂存区所有文件都移动到本地git仓库",
"$ git status  --查看仓库状态",
"$ git push  --把当前分支克隆仓库上传到github仓库合并",
"",
"",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop",
"$ git config --global user.name 'Link'  --设置github账号名称",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop",
"$ git config --global user.email '1183234982@qq.com'  --设置github注册时的邮箱",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop",
"$ mkdir my_repository  --当前目录生成一个文件夹",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop",
"$ cd my_repository  --选中文件夹",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository",
"$ git init  --初始化.git仓库管理文件",
"Initialized empty Git repository in C:/Users/ASUS/Desktop/my_repository/.git/",
"",
"$ touch my_file.html  --当前目录下生成一个文件",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ vi my_file.html  --编辑文件",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ cat my_file.html  --查看文件内容",
"新建文件的内容,完成后Esc退回vi命令行,输入:wq或:x保存内容,:x则不保存内容。",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git status  --查看仓库状态",
"On branch master",
"",
"No commits yet",
"",
"Untracked files:",
"  (use \\"git add <file>...\\" to include in what will be committed)",
"  my_file.html",
"",
"nothing added to commit but untracked files present (use \\"git add\\" to track)",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git add my_file.html  --添加文件到暂存区",
"warning: LF will be replaced by CRLF in my_file.html.",
"The file will have its original line endings in your working directory",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git status  --查看仓库状态",
"On branch master",
"",
"No commits yet",
"",
"Changes to be committed:",
"  (use \\"git rm --cached <file>...\\" to unstage)",
"  new file:   my_file.html",
"",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git commit -m '新建的文件my_file.html'  --暂存区的文件都移动到本地git仓库并设置本次操作相关信息",
"[master (root-commit) f7e10ad] 新建的文件my_file.html",
" 1 file changed, 1 insertion(+)",
" create mode 100644 my_file.html",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git status  --查看仓库状态",
"On branch master",
"nothing to commit, working tree clean",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git config --list  --查看配置列表(:q 结束此命令)",
"diff.astextplain.textconv=astextplain",
"filter.lfs.clean=git-lfs clean -- %f",
"filter.lfs.smudge=git-lfs smudge -- %f",
"filter.lfs.process=git-lfs filter-process",
"filter.lfs.required=true",
"http.sslbackend=openssl",
"http.sslcainfo=D:/GIT/Git/mingw64/ssl/certs/ca-bundle.crt",
"core.autocrlf=true",
"core.fscache=true",
"core.symlinks=false",
"pull.rebase=false",
"credential.helper=manager-core",
"credential.https://dev.azure.com.usehttppath=true",
"init.defaultbranch=master",
"filter.lfs.clean=git-lfs clean -- %f",
"filter.lfs.smudge=git-lfs smudge -- %f",
"filter.lfs.process=git-lfs filter-process",
"filter.lfs.required=true",
"user.name=Link",
"user.email=1183234982@qq.com",
"core.editor=\\"E:\\\\Visual Studio Code\\\\Microsoft VS Code\\\\Code.exe\\" --wait",
"core.repositoryformatversion=0",
"core.filemode=false",
"core.bare=false",
"core.logallrefupdates=true",
"core.symlinks=false",
"core.ignorecase=true",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ git clone https://github.com/wuying-05/my_repository.git  --把一个远程仓库克隆到本地",
"Cloning into 'my_repository'...",
"remote: Enumerating objects: 15, done.",
"remote: Counting objects: 100% (15/15), done.",
"remote: Compressing objects: 100% (11/11), done.",
"remote: Total 15 (delta 3), reused 4 (delta 0), pack-reused 0",
"Receiving objects: 100% (15/15), done.",
"Resolving deltas: 100% (3/3), done.",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository (master)",
"$ cd my_repository  --选中文件夹",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$ git status  --查看仓库状态",
"On branch main",
"Your branch is up to date with 'origin/main'.",
"",
"Untracked files:",
"  (use \\"git add <file>...\\" to include in what will be committed)",
"  others.txt",
"",
"nothing added to commit but untracked files present (use \\"git add\\" to track)",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$ git add others.txt  --添加文件到暂存区",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$ git commit -m '提交others.txt'  --暂存区所有文件都移动到本地git仓库",
"[main 440bdff] 提交others.txt",
" 1 file changed, 0 insertions(+), 0 deletions(-)",
" create mode 100644 others.txt",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$ git status  --查看仓库状态",
"On branch main",
"Your branch is ahead of 'origin/main' by 1 commit.",
"  (use \\"git push\\" to publish your local commits)",
"",
"nothing to commit, working tree clean",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$ git push  --把当前分支克隆仓库上传到github仓库合并",
"Enumerating objects: 3, done.",
"Counting objects: 100% (3/3), done.",
"Delta compression using up to 8 threads",
"Compressing objects: 100% (2/2), done.",
"Writing objects: 100% (2/2), 248 bytes | 248.00 KiB/s, done.",
"Total 2 (delta 1), reused 0 (delta 0), pack-reused 0",
"remote: Resolving deltas: 100% (1/1), completed with 1 local object.",
"To https://github.com/wuying-05/my_repository.git",
"   584e435..440bdff  main -> main",
"",
"蒲公英的夏天@LAPTOP-JHK6PS9J MINGW64 ~/Desktop/my_repository/my_repository (main)",
"$",
"",
  	
  	
  	
  	
  ],
  "description": "git命令操作一个完整流程"
	

@沉木

以上是关于VSCode自定义代码片段——git命令操作一个完整流程的主要内容,如果未能解决你的问题,请参考以下文章

VSCode自定义代码片段15——git命令操作一个完整流程

VSCode自定义代码片段——cli的终端命令大全

VSCode自定义代码片段4——cli的终端命令大全

VSCode 如何操作用户自定义代码片段(快捷键)

VSCode自定义代码片段——CSS选择器

VSCode自定义代码片段(vue主模板)