git 使用笔记,仓库初始化常用命令

一、记录

1.丢弃刚才的编辑新建增加等等(未add 也未commit)

git restore 文件名字    #进行清除工作区的改变
或
git chechout 文件名字    #和restore的作用是一样的;

与git add .的作用相反

1实例:带$的行为关键命令

... MINGW64 /f/Test/vue/front (master)
$ 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 restore <file>..." to discard changes in working directory)
        modified:   src/router/modules/content.js
no changes added to commit (use "git add" and/or "git commit -a")


... MINGW64 /f/Test/vue/front (master)
$ git checkout src/router/modules/content.js
Updated 1 path from the index

$ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean

二、仓库初始化时:简易的命令行入门教程:

Git 全局设置:

git config --global user.name "Pa"
git config --global user.email "1000@qq.com"

创建 git 仓库:

mkdir vue_shop
cd vue_shop
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/aaa/vue_shop.git
git push -u origin master

已有仓库?a

cd existing_git_repo
git remote add origin https://gitee.com/aaa/vue_shop.git
git push -u origin master
posted @ 2020-09-13 21:06  晨光曦微  阅读(529)  评论(0编辑  收藏  举报