- git查看、添加用户名以及邮箱
git config --list
git config --global user.name “userName”
git config --global user.email “userEmail”
- git克隆远程代码
git clone 远程仓库URL (本地仓库自定义名称)
- git查看所有分支
git branch -a
- git切换分支
git remote update origin --prune 检索新分支
git checkout -b 分支名
- git提交代码操作
git pull
git add .
git commit -m "描述"
git push
- git查看、添加、修改远程代码库
git remote -v
git remote add origin 目标URL
git remote set-url origin 目标URL
- git合并分支
git merge 分支名
- git删除分支
git branch -d 分支名 #普通删除分支
git branch -D 分支名 #强制删除分支
- git回滚操作
1:
git log #查看提交记录
git reset --hard 目标版本号
git push -f
2:
git log #查看提交记录
git revert -n 版本号
git commit -m "描述"
git push
3:
git push origin 节点哈希值:HEAD
远程仓库回滚到某节点