often

仓库克隆

git clone git@github.com:BenCoper/BeginJava.git(仓库地址)

查看状态

git status

设置用户

git config --global user.email ysjcode@gmail.com

设置用户名

git config --global user.name BenCoper

查看日志

git log

添加暂存

git add 文件名

推送仓库

git commit -m "添加提交信息"

密钥

创建密钥

ssh-keygen -t rsa -b 4096 -C "ysjcode@gmail.com"(邮箱地址)

密钥复制

clip < ~/.ssh/id_rsa.pub

冲突解决

查看commit事件

git show ....(commitID,日志中查看)

回滚暂存

git reset (后面可接commitID,回滚单个)

推送远端

git push

更新

git pull

团队协作

创建分支

git branch 分支名称

切换分支

git checkout 分支名称

设置远端分支

git push --set-upstrean orgin 分支名称

切换第二分支

git checkout -b 分支名称2

合并分支到master

git merge 分支名称(1或2)

其他

忽略.idea文件

git文件内添加 .idea/
10-26 10:12