git reset HEAD使用

简介:

修改demo1.txt文件

vim demo1.txt

修改hello.php

vim hello.php

查看文件状态

git status -s

添加到缓存区

git add .

查看文件状态

git status -s

将hello.php从缓存区清除

git reset HEAD -- hello.php

查看文件状态

git status -s

提交文件

git commit -m '修改demo1'

查看文件状态

git status -s

命令行输出

wKioL1jKA7ezuV_JAAD0E7XLzOM910.png-wh_50



本文转自 素颜猪 51CTO博客,原文链接:http://blog.51cto.com/suyanzhu/1907146

相关文章
|
6月前
|
编译器 开发工具 git
【Git异常】You are in ‘detached HEAD‘ state, which means that you‘re not on any branch Checkout a branch
【Git异常】You are in ‘detached HEAD‘ state, which means that you‘re not on any branch Checkout a branch
67 0
|
8月前
|
开发工具 git
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
成功解决git rebase问题:First, rewinding head to replay your work on top of it...
|
网络安全 开发工具 git
git 出现错误:kex_exchange_identification: read: Connection reset by peer fatal
git 出现错误:kex_exchange_identification: read: Connection reset by peer fatal
git 出现错误:kex_exchange_identification: read: Connection reset by peer fatal
|
存储 JavaScript 前端开发
细读 Git | 让你弄懂 origin、HEAD、FETCH_HEAD 相关内容
细读 Git | 让你弄懂 origin、HEAD、FETCH_HEAD 相关内容
3591 1
细读 Git | 让你弄懂 origin、HEAD、FETCH_HEAD 相关内容
|
4月前
|
存储 开发工具 git
(详解踩坑)GIT版本回滚git stash、git reset、git reset --hard、git revert
(详解踩坑)GIT版本回滚git stash、git reset、git reset --hard、git revert
64 0
|
5月前
|
开发工具 git
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
【Git】push代码时候报错,出现fatal: unable to access xxx Recv failure: Connection was reset
103 0
|
9月前
|
开发工具 git
git clone & git reset 补充
git clone & git reset 补充
49 0
|
11月前
|
Shell 开发工具 git
Git detached HEAD解决方案_张童瑶的博客
利用 游离状态 的那个 版本号创建一个新的分支, git branch xxx 游离版本的版本号。这时,这个新创新的分支的代码就是我们 这个版本号中的代码了。在切换分支到主分支master:git checkout master .。最后 把新创建的那个分支融合到我么你的主分支上,这样游离状态的代码就融合到我们主分支上了。游离状态也解除了。
87 0
|
11月前
|
开发工具 git
【git】解决OpenSSL SSL_read: Connection was reset, errno 10054 ...
【git】解决OpenSSL SSL_read: Connection was reset, errno 10054 ...
204 0
|
开发工具 git
git reset 撤销后找回
git reset 撤销后找回
111 0

相关实验场景

更多