Git是一个分布式版本控制软件,本文介绍了该工具的典型学习门路,并列数了必须要非常理解的要害命令。
独立根本应用
作为版本管理工具仅为了保留订正历史,在不思考与其他人合作与多版本保护时,你须要相熟以下命令。
git initgit clone <repository>git statusgit add <file>git add --allgit commitgit remote addgit remote set-urlgit remote -vgit push <repository> <branch>git pull <repository> <branch>
要害的配置
当你应用的越来越多时你会发现有些操作很繁琐,这时候你须要学习一些要害配置,使你本人的差别诉求失去满足。
git log git checkout <file>git reset <file> git reset --hard git clean -f git rm <file> git config --global user.namegit config --global user.emailgit stashgit stash applygit stash clear
多人合作应用
当你须要与其他人独特保护一个我的项目时,你须要把握相应的分支检出、分支创立、分支合并、查看订正历史等性能。
git mergegit branchgit checkout <branch>git checkout -bgit blame <file>git rebasegit push --force-with-lease (DANGEROUS)
版本管理员
如果你从事我的项目的版本管理工作,那么你须要理解更业余的一些操作,包含更具体的查看分支、比拟分支、复原版本、更改订正、修复版本问题等。
git commit --amendgit rebase -igit prunegit fetchgit remote prunegit checkout HEAD/HEAD~1/<commit hash>git diff <commit hash 1> <commit hash 2>git revert <commit hash>git refloggit-filter-branchgit-filter-repogit bisect
版权申明,本文首发于 数字魔盒 https://www.dm2box.com/ 欢送转载。