vscode配合github使用

发布时间:2022-10-10 12:30

vscode配合github使用_第1张图片
需要先执行命令把用户名和邮箱写入

在终端中运行如下代码

git config user.name 你的github用户名
git config user.email 邮箱地址

缩写含义

A - Added (This is a new file that has been added to the repository)

M - Modified (An existing file has been changed)

D - Deleted (a file has been deleted)

U - Untracked (The file is new or has been changed but has not been added to the repository yet)

C - Conflict (There is a conflict in the file)

R - Renamed (The file has been renamed)

S - Submodule (In repository exists another subrepository)

视频解说

…or create a new repository on the command line
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/test.git
git push -u origin main
…or push an existing repository from the command line
git remote add origin https://github.com/username/test.git
git branch -M main
git push -u origin main
…or import code from another repository
You can initialize this repository with code from a Subversion, Mercurial, or TFS project.

不知道为什么交互不行,直接在powershell终端运行就可以,还挺快
有图

# 后续貌似秩序这样的命令了
git add .
git commit -m "first commit"
git push -u origin main
# 其余的可能只是第一次使用设置一下就可以了

查看历史commit并实现历史版本的回滚

git log
#之后一直按回车一次查看,应该是进入了vim,之后按q退出
# 找到对应的想返回的commit id
git reset --hard f07f4d030611cd57db27aee7187cb86bb233de57 
# 回滚成功

参考
有图

创建新的分支

# 回滚历史版本后就无法在main分支中
# 需要创建新的分支
git checkout -b main2
#上传更新到新的分支
git add.
git push -u origin main2

参考

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号