GitHub 命令行操作(完善中)

GitHub 命令行

本地repo

  • 设置姓名和邮箱

    git config --global user.name "xxxx"

    git config --global user.email "[email protected]"

  • 创建并初始化本地空仓库

    git init <repo_name>

  • 查看提交的状态

    git status

  • 暂存区中添加更改

    git add <file_name>

  • 记录一行提交信息

    git commit -m "commit info"

  • 提交记录

    git log

  • 忽略特定格式文件格式

    touch .gitignore && vim .gitigonre

    *.out *.py # in .gitignore

    原有创建的格式用 git rm --cached <file_name> 忽略 常用工程的ignore文件

  • 回滚操作

    git reset (--mixed --hard --soft ) HEAD~(可换) #自己查询参数

    git commit --amend 轻微修改,不进行新的提交

远程repo

  • 查看分支

    git branch

  • 创建分支

    git branch <branch_name

  • 切换到分支

    git checkout <branch_name>

  • 创建并且切换

    git checkout -b <branch_name>

  • 分支合并

  • 分支同步

  • 分支删除与重命名

  • tag 管理

猜你喜欢

转载自www.cnblogs.com/hanxinle/p/11605676.html
今日推荐