转圈圈

Git 常用命令

基本操作

  • git init
    • git init repository
    • git init
  • git add
    • git add .
    • git add filename
  • git commit
    • git commit -m "saysomething"
    • git commit #
  • git push

版本控制

  • git log
    • git log --pretty=online
    • git log --graph // 查看分支合并图
  • git diff filename
  • git status
  • git reset
    • git reset --hard HEAD^
    • git reset --hard 版本号
  • git reflog
  • git checkout --filename

远程库

  • ssh-keygen -t rsa -C 'youremail@example.com'
  • git remote add origin 'git@gitee.com**'
  • git push -u origin master // 首次提交加参数 -u

分支管理

  • git checkout -b branchname // 创建分支并且切换到分支
    • git branch // 常看分支
    • git branch branchname // 新建分支
    • git checkout branchname // 切换分支
  • git merge branchname// 合并branchname 到当前分支
  • git branch -d branchname // 删除指定分支
  • git merge --no-ff -m "merge with no-ff" dev // 警用 fast-forward
posted @ 2019-03-18 23:09  rosendolu  阅读(85)  评论(0编辑  收藏  举报