Git使用常用命令以及基础

34 阅读1分钟

工具下载

registry.npmmirror.com/binary.html…

注册邮箱

git config --global user.name '自定义名字,不要太简单'

git config --global user.email '自定义邮箱'

克隆

git clone +地址

添加暂存+提交到本地

添加到暂存: git add .

提交到本地仓库: git commit -m '日志'

推送本地仓库到远程仓库

推送到远程: git push [origin master]

git 命令总结

1 克隆 git clone url

2 添加暂存 git add .

3 提交到本地仓库 git commit -m '日志'

4 推送到远程仓库 git push [origin 分支]

5 拉取 git pull [origin 分支]

6 新建分支 git checkout -b 子分支名

7 切换分支 git checkout 分支名

8 查询所有分支 git branch

9 删除子分支 git branch --delete 子分支名

10 当前分支合并目标分支 git merge 目标分支

11 查看历史版本记录 git log -g

12 回退版本 git reset --hard 版本号