Git常用命令使用总结

来源:互联网 发布:流程优化的意义 编辑:程序博客网 时间:2024/05/18 03:42

1. 修改最近一次commit,不会改变changeId

git commit --amend

2. 更改git 树中某个旧的commit (多个)

git rebase -i HEAD~nchange the code git addgit commit --amendgit rebase --continue

3. git reset 参数

soft     只影响HEADmixed(默认)影响HEAD和Indexhard    彻底 

4. 把远程分支迁移到本地

git checkout -b test origin/test

5. 获取最新版本到本地分支

git fetch origin feature-setting:temp

6. 获取最新代码

git pull --rebase产生冲突,修改冲突git add .git rebase --continue

7. Esc 退出insert模式 按两次大写的ZZ

8. 恢复修改的文件

1.未addindex:git checkout  .(file_name)2.addindex:git reset HEAD .(file_name)  接着执行第一步
0 0