git常用命令集合
-
初始化仓库
git init
-
添加文件
git add .
git add 文件名
-
查看文件状态
git status
-
提交更改
git commit -m"信息"
-
查看分支
git branch
-
修改本地分支名
git branch -m 原分支名 新分支名
-
创建分支
git branch 分支名
-
创建并直接切换分支
git checkout -b 分支名
-
切换分支
git checkout 分支名
-
合并分支
git merge 分支名
-
删除本地分支
git branch -d 分支名
-
操作远程仓库
git remote
查看所有远程仓库git remote set-url origin
你新的远程仓库地址git remote add origin \
远程仓库地址
-
克隆远程仓库
git clone 远程仓库地址
-
pull操作
git pull <远程仓库名> <远程分支名>:<本地分支名>
将远程指定分支 拉取到 本地指定分支上git pull <远程仓库名> <远程分支名>
将远程指定分支 拉取到 本地当前分支上
-
回退\前进一个版本
git reset --hard HEAD^ HARD就是版本号 可以通过git log来查询
-
推送操作
git push -u 远程仓库地址别名 本地分支:远程分支
来源:CSDN
作者:维多利亚少年-
链接:https://blog.csdn.net/weixin_45532305/article/details/104615171