Git的使用!

GIT:版本控制系统

  • git init 初始化仓库
  • git status 查看整个仓库的状态
  • git add -A 将工作区所有文件提交到缓冲区
  • git commit -m “注释” 将缓冲区所有文件提交到版本库
  • git diff 文件名 对比文件
  • git checkout – 文件名 将某一个文件的修改撤回至与上一次工作区相一致的情况
  • git log 查看提交日志
  • git reflog 查看提交日志(包含回退操作)
  • git reset --hard 版本号 将工作区调整到某一个版本上
  • ssh-keygen -t rsa -C “你的邮箱” 导出公钥和私钥
  • git commit -am “注释” 将所有工作区内修改的文件绕过缓冲区直接向版本库进行提交
  • git push 将本地版本库内的内容同步到远程库中
  • git clone 将远程库克隆到本地
  • git pull 将远程库内的内容同步到本地版本库中

简易的命令行入门教程:

  1. Git 全局设置:

git config --global user.name “可乐不加冰”
git config --global user.email “[email protected]

  1. 创建 git 仓库:

mkdir project
cd project
git init
touch README.md
git add README.md
git commit -m “first commit”
git remote add origin [email protected]:xin-zhao/project.git
git push -u origin master

  1. 已有仓库?

cd existing_git_repo
git remote add origin [email protected]:xin-zhao/project.git
git push -u origin master

svn六个步骤: 查出 提交 更新 比较差异 更新日志 编辑冲突

猜你喜欢

转载自blog.csdn.net/m0_54625720/article/details/112983120
今日推荐