git常用命令(持续更新)

# 初始化一个新的Git仓库
git init

# 克隆远程仓库到本地
git clone <repository_url>

# 配置用户信息
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

# 查看文件状态
git status

# 将文件添加到暂存区
git add <file_name>

# 添加所有更改到暂存区
git add .

# 提交更改到仓库
git commit -m "Your commit message"

# 查看提交历史
git log

# 创建新分支
git branch <branch_name>

# 切换分支
git checkout <branch_name>
# 或者使用
git switch <branch_name>

# 合并分支
git merge <branch_name>

# 拉取远程更改到本地分支
git pull origin <branch_name>

# 推送本地更改到远程仓库
git push origin <branch_name>

# 查看远程仓库信息
git remote -v

# 创建并切换到新分支
git checkout -b <new_branch_name>

# 查看分支列表
git branch

posted @ 2023-10-11 10:34  Leewell_fx  阅读(23)  评论(0)    收藏  举报