Git

Git

添加分支  git branch 分支名

查看分支 git branch

查看当前所在分支 git status

切换分支 git  checkout ‘分支名’

添加 git add 文件名

提交 git commit -m ‘提交标识名’

合并分支 git merge 分支名 (你在哪个分支就会将其他分支合并给你)

删除分支 git branch -d 分支名

远程仓库

创建远程仓库(码云)

  1. 生成SSH公钥步骤

(1) 创建Git账户

① Git config user.name(查看git账户)

② Git config user.email (查看git邮箱)

③ Git config --global user.name ‘账户名’ (设置全局账户名和邮箱)

④ Git config --global user.email ‘邮箱’

⑤ Cd ~/.ssh  (查看是否生成过公钥)

⑥ Ssh-keygen -t rsa -C “邮箱”

 

⑦ Cat ~/.ssh/id_rsa.pub

  1. 设置账户公钥
  2. 公钥测试

(1) Ssh -T git@gitee.com

推送远程仓库

步骤:

  1. 推送仓库的URL(网址),自定义仓库名称

(1) Git remote add 远程名称 远程仓库URL(自定义仓库名称)

(2) Git push -u 仓库名称 分支名 (推送远程仓库)

  1. 远程仓库平台

(1) 先有远程仓库,本地仓库为空

步骤:

① 将远程仓库的代码克隆到本地仓库

1) Git clone 仓库地址(克隆命令)

② 创建新文件,添加并提交本地仓库

③ 推送至远程仓库

④ 项目拉取更新

1) Git pull 远程仓库名 分支名 (拉取命令)

IDEA集成git

步骤:

  1. 创建IDEA本地仓库
原文地址:https://www.cnblogs.com/xiaobenke/p/14861621.html