Git常用命令

2016-07-21  本文已影响24人  eoeoops
  1. 不小心在项目后台直接删除分支
    git fetch -p origin

  2. 查看log
    git log

  3. 回退到某个版本
    git reset --hard xxxxx(commit hash)

  4. 推送所有标签
    git push origin --tags

  5. 设置用户名和邮箱

    git config --global user.name [username]
    git config --global user.email [email]
    
  6. 查看已设配置
    git config --list

  7. 从git管理中移除重新添加

    git rm -r --cached . 
    git add .
    
  8. fatal: refusing to merge unrelated histories

    git pull origin master --allow-unrelated-histories
    
  9. 重置远程仓库地址

    git remte origin set-url URL
    
  10. 删除远程tag

    git push origin --delete tag <tagname>
    
  11. 删除本地tag

    git tag -d <tagname>
    
上一篇 下一篇

猜你喜欢

热点阅读