才艺多网站建设平台,电子商务网站建设意义,南宁制作企业服装,门户网站开发流程github清除在add或者commit之后缓存区 前言1. 第一步之后想要撤销2. 第二步之后想要撤销a. 改变一下rrr.txt的内容b. 想提交本地文件的test文件夹c. 我后悔了突然不想提交了 前言
github自用
一般github上代码提交顺序#xff1a;
第一步#xff1a;
git add .
or
git ad… github清除在add或者commit之后缓存区 前言1. 第一步之后想要撤销2. 第二步之后想要撤销a. 改变一下rrr.txt的内容b. 想提交本地文件的test文件夹c. 我后悔了突然不想提交了 前言
github自用
一般github上代码提交顺序
第一步
git add .
or
git add home/.../.../file_name
or
git add home/.../.../file_name -f第二步
git commit -m test...第三步
git push1. 第一步之后想要撤销
使用git reset .命令
效果展示
xxxxxxserver:~/xxxxxx/test_rm_cache$ git add test/1rrr.txt -f
xxxxxxserver:~/xxxxxx/test_rm_cache$ git status
On branch main
Your branch is up-to-date with origin/main.Changes to be committed:(use git restore --staged file... to unstage)new file: test/1rrr.txtxxxxxxserver:~/xxxxxx/test_rm_cache$ git reset .
xxxxxxserver:~/xxxxxx/test_rm_cache$ git status
On branch main
Your branch is up-to-date with origin/main.nothing to commit, working tree clean2. 第二步之后想要撤销
github的内容 本地文件
a. 改变一下rrr.txt的内容
xxxxxxserver:~/xxxxxx/test_rm_cache$ git add .
xxxxxxserver:~/xxxxxx/test_rm_cache$ git status
On branch main
Your branch is up-to-date with origin/main.Changes to be committed:(use git restore --staged file... to unstage)modified: rrr.txtxxxxxxserver:~/xxxxxx/test_rm_cache$ git commit -m test1
[main 6e51030] test11 file changed, 1 insertion()xxxxxxserver:~/xxxxxx/test_rm_cache$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 24 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 244 bytes | 244.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To github.com:ZisongXu/test_rm_cache.git942633e..6e51030 main - main
xxxxxxserver:~/xxxxxx/test_rm_cache$github内容 本地文件
b. 想提交本地文件的test文件夹
xxxxxxserver:~/xxxxxx/test_rm_cache$ git add test/1rrr.txt -f
xxxxxxserver:~/xxxxxx/test_rm_cache$ git status
On branch main
Your branch is up-to-date with origin/main.Changes to be committed:(use git restore --staged file... to unstage)new file: test/1rrr.txtxxxxxxserver:~/xxxxxx/test_rm_cache$ git commit -m test2
[main 9375ba3] test21 file changed, 2 insertions()create mode 100644 test/1rrr.txtxxxxxxserver:~/xxxxxx/test_rm_cache$ 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
xxxxxxserver:~/xxxxxx/test_rm_cache$c. 我后悔了突然不想提交了
xxxxxxserver:~/xxxxxx/test_rm_cache$ git reset HEAD~
xxxxxxserver:~/xxxxxx/test_rm_cache$ git reset --hard HEAD
HEAD is now at 6e51030 test1
sc19zxserver:~/apptainers/test_rm_cache$ git status
On branch main
Your branch is up-to-date with origin/main.nothing to commit, working tree clean
xxxxxxserver:~/xxxxxx/test_rm_cache$ git push
Everything up-to-date
xxxxxxserver:~/xxxxxx/test_rm_cache$github内容 本地文件