Git常用语法和命令:
1. 初始化Git仓库:
```
git init
```
2. 克隆现有仓库:
```
git clone [url]
```
3. 查看仓库状态:
```
git status
```
4. 添加文件到暂存区:
```
git add [file]
```
5. 提交修改:
```
git commit -m "[message]"
```
6. 查看提交历史:
```
git log
```
7. 撤销修改:
```
git restore [file]
```
8. 分支操作:
- 查看分支:`git branch`
- 创建分支:`git branch [name]`
- 切换分支:`git checkout [name]`
- 创建并切换分支:`git checkout -b [name]`
- 合并分支:`git merge [name]`
- 删除分支:`git branch -d [name]`
9. 远程仓库操作:
- 查看远程仓库:`git remote -v`
- 添加远程仓库:`git remote add [name] [url]`
- 拉取远程分支:`git pull [remote] [branch]`
- 推送本地分支到远程仓库:`git push [remote] [branch]`
10. 标签操作:
- 查看标签:`git tag`
- 创建标签:`git tag [name]`
- 查看标签详细信息:`git show [name]`
- 删除标签:`git tag -d [name]`
以上是Git常用的语法和命令,仅供参考,Git的功能非常丰富,建议进一步学习和实践。