2025年git详细教程(git简易教程)

git详细教程(git简易教程)欢迎来到初学者的 Git 和 GitHub 这份综合指南旨在帮助您探索版本控制和协作的世界 设置一个可识别的名称 用于在审查版本历史时进行认可 git config global user name Your Name p p p 设置与每个历史标记相关联的电子邮件地址 br git config p

大家好,我是讯享网,很高兴认识大家。



# 设置一个可识别的名称,用于在审查版本历史时进行认可

\( git config --global user.name &#34;Your Name&#34;</p><p># 设置与每个历史标记相关联的电子邮件地址<br>\) git config –global user.email “”

git config –global –list .

# 设置 Git 的默认编辑器
\( git config --global core.editor &#34;code --wait&#34;</p><p># 初始化名为 my-project 的新存储库<br><br>\) git init my-project

\( git remote add origin repository-url</p><p>\) git pull origin main


讯享网

\( git checkout main</p><p>\) code file-name  # 例如,code index.html

# 检查当前分支的状态

\( git status  # 在主分支上</p><p># 将文件添加到暂存区<br><br>\) git add .  # 要提交的更改:



\( git add 文件名  # 要提交的更改:</p><p># 将更改提交到当前分支<br><br>\) git commit -m “提交消息”   # 例如,git commit -m “Initial commit”

# 将更改推送到远程存储库

\( git push origin main  # 例如,git push origin master</p><p># 创建一个新分支<br><br>\) git branch &lt;branch-name&gt;  # 例如,git branch feature-branch

# 切换到新创建的分支

\( git checkout &lt;branch-name&gt;  # 例如,git checkout feature-branch</p><p># 删除分支<br><br>\) git branch -d &lt;branch-name&gt;  # 例如,git branch -d feature-branch

\( git checkout feature-branch</p><p>git checkout feature-branch<br>切换到一个新分支 &#39;feature-branch&#39;<br>分支 &#39;feature-branch&#39; 设置为跟踪 &#39;origin/feature-branch&#39;。</p><p>\) touch feature-branch-file.txt

\( echo &#34;这是特性分支中的一个文件&#34; &gt;&gt; feature-branch-file.txt</p><p>\) git add .

\( git commit -m &#34;向特性分支添加文件&#34;</p><p>\) git push origin feature-branch

小讯
上一篇 2025-06-07 08:48
下一篇 2025-06-02 16:13

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/176918.html