GitHub 资源查找与常用命令

127 阅读1分钟

常用的前缀后缀

  • 找百科大全 awesome xxx
  • 找例子 xxx sample
  • 找空项目架子 xxx starter / xxx boilerplate
  • 找教程 xxx tutorial

常用命令

  • 初始化仓库:git init

  • 添加文件到暂存区:git add -A

  • 把暂存区的文件提交到仓库:git commit -m 提交信息

  • 查看提交的历史记录:git log --stat

  • 工作区回滚:git checkout filename

  • 撤销最后一次提交:git reset HEAD^1

  • 以当前分支为基础新建分支:git checkout -b branchname

  • 列举所有的分支:git branch

  • 单纯地切换到某个分支:git checkout branchname

  • 删掉特定的分支:git branch -D branchname

  • 合并分支:git merge branchname

  • 推送当前分支最新的提交到远程:git push

  • 拉取远程分支最新的提交到本地:git pull