Quick setup — if you’ve done this kind of thing before
or
https://gecgithub01.walmart.com/vn55gxn/shen_work.git
Get started by creating a new file or uploading an existing file. We recommend every repository include a README, LICENSE, and .gitignore.
…or create a new repository on the command line
echo "# shen_work" >> README.md
-- 初始化
git init
-- 提交到本地暂存区
git add README.md
-- 提交到仓库
git commit -m "first commit"
git branch -M main
git remote add origin https://gecgithub01.walmart.com/vn55gxn/shen_work.git
git push -u origin main
--显示状态
git status
--显示不同
git diff readme.txt
-- 版本回退:
-- 查看下历史记录
git log
简洁版
git log –pretty=oneline
回退到上一个版本
git reset --hard HEAD^
回退到上2个版本
git reset --hard HEAD^^
回退到上100个版本
git reset --hard HEAD~100
通过版本号 6fcfc89 回退
git reset --hard 6fcfc89
错误修改工作区后,想恢复到未修改前提交都暂存的内容
git checkout -- readme.txt
…or push an existing repository from the command line
git remote add origin https://gecgithub01.walmart.com/vn55gxn/shen_work.git
git branch -M main
git push -u origin main
git使用
最新推荐文章于 2024-09-14 16:36:34 发布
本文介绍了如何使用Git进行项目初始化、文件操作(如添加、提交和查看差异)、分支管理、远程仓库连接、提交历史记录以及基本的版本回退和错误修复。
摘要由CSDN通过智能技术生成