python git命令
时间: 2023-10-13 14:28:51 浏览: 212
以下是常用的 Git 命令:
1. 初始化仓库:
```
git init
```
2. 克隆仓库:
```
git clone <url>
```
3. 添加文件到暂存区:
```
git add <file>
```
4. 提交文件到仓库:
```
git commit -m "commit message"
```
5. 查看当前状态:
```
git status
```
6. 查看修改内容:
```
git diff <file>
```
7. 查看提交历史:
```
git log
```
8. 撤销修改:
```
git checkout -- <file>
```
9. 撤销暂存:
```
git reset HEAD <file>
```
10. 回滚到指定版本:
```
git reset --hard <commit>
```
11. 推送修改到远程仓库:
```
git push
```
12. 拉取远程仓库的修改:
```
git pull
```
13. 创建新分支:
```
git branch <branch>
```
14. 切换分支:
```
git checkout <branch>
```
15. 合并分支:
```
git merge <branch>
```
16. 删除分支:
```
git branch -d <branch>
```
以上是一些常用的 Git 命令,更多命令可以在 Git 官方文档中找到。
阅读全文
相关推荐















