忻隽薇 發表於 2023-9-21 00:00:00

Ubuntu系统怎么用git新增分支并且提交?

<p>
        今天我们就来讲讲在Ubuntu里用git新增分支并且提交的方法,很简单,请看下文详细介绍。</p>
<p>
        git branch newbh</p>
<p>
        我们创建一个新的分支newbh。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/6c968d65231c388c4f7b51117abf98d9.jpg" width="500"></p>
<p>
        git branch</p>
<p>
        就能看到当前有的分支。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/1b84663d5f674c59b07f2a320630092b.jpg" width="500"></p>
<p>
        git checkout newbh</p>
<p>
        这样我们就能转换到newbh分支。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/b1e2b2d85cdd7718757158853ffe5c61.jpg" width="500"></p>
<p>
        git branch</p>
<p>
        能用颜色辨认已经切换到这个分支了。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/71b195395753ad06b70ae2e68dca1835.jpg" width="500"></p>
<p>
        修改一下文件。</p>
<p>
        git status</p>
<p>
        git add -A</p>
<p>
        然后我们添加到暂缓区。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/0b3eba4517190d90609939549b061b95.jpg" width="500"></p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/2729c1f9de08bb86b270503908333334.jpg" width="500"></p>
<p>
        git commit -m ""</p>
<p>
        然后我们提交一下到本地版本库。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/bf6e578ac277ebb97a94909d090c6040.jpg" width="500"></p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/3254538381ce4dd52716a22685857593.jpg" width="500"></p>
<p>
        git push -u orgin newbh</p>
<p>
        然后我们就可以提交到远程仓库。</p>
<p>
        git branch -a</p>
<p>
        查看全部分支。</p>
<p align="center">
        <img style="max-width:100%!important;height:auto!important;"title="Ubuntu系统怎么用git新增分支并且提交?" alt="Ubuntu系统怎么用git新增分支并且提交?" align="" border="0" src="https://zhuji.jb51.net/uploads/img/202305/821343b277b4affd824c22d5510f2d4a.jpg" width="500"></p>
<p>
        以上就是Ubuntu系统用git新增分支并且提交的方法,希望大家喜欢,请继续关注。</p>
頁: [1]
查看完整版本: Ubuntu系统怎么用git新增分支并且提交?