前言版本控制器GitGit的本地使用安装 代码语言:javascript代码运行次数:0运行复制
<code class="javascript">//安装Gitsudo yum install git -y</code>
<code class="javascript">//创建本地仓库.gitgit init</code>
<code class="javascript">//设置用户名和邮件地址git config --global user.name "your name"git config --global user.email "your-email@example.com"//删除用户名和邮件地址git config --global --unset user.name "your name"git config --global --unset user.email "your-email@example.com"//查看配置列表git config -l</code>

<code class="javascript">//将目标文件从工作区移动到暂存区 git add xxx//查看本地仓库的缓存区git status//将当前暂存区中的更改正式提交到本地的Git仓库,并为此次提交附上一条描述性的消息git commit -m "日志信息"//显示项目的提交历史记录git reflog</code>
<code class="javascript">//如果你只是修改了xxx而没有执行git add xxx,那么git diff xxx将显示这些修改的内容git diff xxx</code>

<code class="javascript">//回退版本库git reset --soft file.id(HEAD^)(HEAD^^)//回退版本库、暂存区git reset --mixed file.id(HEAD^)(HEAD^^)//回退版本库、暂存区、工作区git reset --hard file.id(HEAD^)(HEAD^^)//把工作区的文件恢复到最近一次提交的版本git checkout -- file.name</code>






<code class="javascript">//查看现有分支git branch//创建新的分支xxxgit branch xxx//切换分支xxxgit checkout xxx//合并分支到主分支上git merge xxx//删除分支xxxgit branch -d xxx</code>
<code class="javascript">//将远程的仓库添加到本地git clone warehouse_link//将本地仓库的提交推送到远程仓库git push</code>
以上就是【Linux】Git原理与使用的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号