You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

* 创建本地及远程仓库
```shell
# 从命令行创建一个新的仓库
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin http://x.x.x.x:1314/X6738/yfzx-yn-cloudmirror-group-v3.0.git
git push -u origin main
# 从命令行推送已经创建的仓库
git remote add origin http://x.x.x.x:1314/X6738/yfzx-yn-cloudmirror-group-v3.0.git
git push -u -f origin main
```
* 常用命令
```shell
# 列出本地分支及最后一次提交
git branch -v
# 检出远程地址
git clone xxxxxxx.git
# 检出远程分支
git clone -b xxx xxxxx.git
# 把指定暂存区文件提交到本地仓库
git commit -m "<描述信息>" xxx.java
# 提交全部
git commit -m "<描述信息>" *
# 从远程仓库获取最新的版本到本地tmp分支
git fetch <远程主机名> <分支名>
# 显示提交记录
git log
# 本地仓库分支推送到远程仓库
git push <远程仓库> <本地分支名><远程分支名>
# 列出远程仓库详细信息
git remote -v
# 查看本地仓库状态
git status
# 从远程仓库获取最新版本
git pull
```