克隆项目
git clone [url]
显示所有本地分支
git branch
显示所有远程分支
git branch -r
显示所有本地分支和远程分支
git branch -a
新建分支
git branch [name]
切换分支
git checkout [name]
合并分支
git merge [name]
删除分支
git branch -d [name]
添加目录至暂存区
git add [dir]
添加文件至暂存区
git add [file1] [file2]
提交暂存区文件至仓库区
git commit -m [message]
提交暂存区指定文件至仓库区
git commit [file1] [file2] -m [message]
查看变更文件
git status
查看暂存区和工作的差异
git diff
更新远程仓库
git pull [branch]
提交暂存区至远程仓库
git push
撤销暂存区文件更改
git checkout [file]
删除错误提交commit
git reset --hard [commit_id]
git push origin HEAD --force
查看Git仓库源地址
git remote -v
修改当前仓库源地址
git remote set-url origin [git url]
添加新的Git仓库源地址
git remote add [name] [git url]
删除Git仓库源地址
git remote remove [name]
Git常用命令(持续更新...)
最新推荐文章于 2024-12-01 13:45:50 发布