Git命令小结

  • 分支
  1. 查看分支:git branch
  2. 创建分支:git branch <name>
  3. 切换分支:git checkout <name>或者git switch <name>
  4. 创建+切换分支:git checkout -b <name>或者git switch -c <name>
  5. 合并某分支到当前分支:git merge <name>
  6. 删除分支:git branch -d <name>
  • 账户(在 push 的时候需要设置账号与密码,该密码则是 github 的账号与密码)
  1. 设置记住密码(默认15分钟): git config --global credential.helper cache
  2. 如果想自己设置时间,可以这样做(1小时后失效): git config credential.helper 'cache --timeout=3600'
  3. 长期存储密码: git config --global credential.helper store
  4. 配置用户和邮箱  
    1. git config user.name '张三'
    2. git config user.email 'zhangsan@163.com'
posted @ 2019-11-01 10:16  沐军  阅读(147)  评论(0编辑  收藏  举报