终端命令操作
add了文件,从工作区去掉
|
1 |
git restore --staged test.txt |
没有add,撤销改动
|
1 |
git restore test.txt |
commit了,没有push,撤销commit,保留文件改动
|
1 |
git reset --soft HEAD~1 |
commit了,没有push,撤销commit,不保留文件改动
|
1 |
git reset --hard HEAD~1 |
本地commit了多(3)次,没有push,合并为一次
- 进入编辑
|
1 |
git rebase -i HEAD~3 |
- 可以修改顺序,或操作,保存退出
|
1 2 3 |
pick a1b2c3 commit 1 pick d4e5f6 commit 2 pick 789abc commit 3 |
|
1 2 3 4 5 |
// 合并一次 pick a1b2c3 commit 1 s d4e5f6 commit 2 s 789abc commit 3 |
- 编辑
commit信息,留下一条,保存退出
|
1 2 3 4 5 6 7 |
# This is a combination of 3 commits. commit 1 message commit 2 message commit 3 message |
|
1 2 3 |
# This is a combination of 3 commits. commit 1 message |
声明:本文为原创文章,版权归Aet所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ Git应用记述一06/06
- ♥ Stash10/02
- ♥ Learn Git Branching01/02
- ♥ Cef:沙盒、CefApp、CefClient02/29
- ♥ 寄存器和内存访问03/28
- ♥ 【Manjaro】Vmware分辨率不能修改03/22