IDEA中使用GIT版本控制工具
IDEA中使用Git功能
(克隆、提交、推送、分支、冲突解决、历史查看、版本回退、版本对比)
目录:
- IDEA 中的配置git执行的对应路径
- 提交项目到git暂存区
- 从 Git 中拉取项目
- 分支开发
- 查看历史提交记录
- 与其他版本比较
- 回退到其他版本
1. IDEA 中的配置git执行的对应路径
1)在 右上角的FIle中找到《Settings》- 《Vwesion Control》- 《Git》,选择git可执行文件的路径
2) 一般情况下按照正确的步骤配置,点击Test会弹出git版本的提示
3) 选择你本机的Git安装路径下的bin/git.exe
4) 然后applay,在OJBK
2.提交项目到git暂存区
1)首先需要将当前项目导入到 gitHup中,VCS -> Import into Version Control -> Sharee Project on GitHub
2)然后我们在点开VCS查看,就会变成这个样子,对,就是我们需要的样子,现在可以开启一波骚气的操作了
3)add到本地仓库,也可以使用快捷键 Ctrl + Alt + A
4)commit到本地仓库
也可以注直接Commit,点击这里会自动将需要提交的文件选中
5)接下来进行这些步骤
部分文件是不需要提交的,可以下载一下这个插件,如图
安装完后,需要重启idea
创建.gitignore文件
push到远程仓库
推送到远程仓库
初次推送会出现这样的Login弹窗,输入自己的账号及密码就好了,第一次需要输入,再次推送就不需要登陆了
打开git,就可以看到刚刚提交到的项目啦
3. 从 Git 中拉取项目
1)先找到Git仓库地址
2)来,让我们找到这里,对,点它
3)来,下面的操作是酱紫的啦
4)可以点击Test来测试一哈子
5)test转了半天没有动静,等不及了,点Clone,进行下一步吧,这里需要将远程仓库的项目,拉去到本地,需要在有网络的地方,网速慢的话需要稍作等待
6)等拉去完后,会有一个 这样的提示框,点 YES
7) 然后就是这个界面了,看哈子左下角,点Add as Maven Propect
8) 接下来打开 propect,就可以看到从git拉去的项目啦~
如果项目中Maven有应配置的话,还需要将对应路径改为本机的maven仓库,在此承蒙各位大爷关照,就不在进行特举此例,各位爷可以到对面的怡红院去瞅一瞅有您需要的,如果没有异议,那咱继续
Ayo,在你的头上暴扣
4.分支开发
来,看哈子重点
Git分支是由指针管理起来的,所以创建、切换、合并、删除分支都非常快,非常适合大型项目的开发。
在分支上做开发,调试好了后再合并到主分支。那么每个人开发模块式都不会影响到别人。
不太明白的话人家画张图
咯,就是这个样子
接下来,继续操作
1)先导入到GitHub中
2)之后可以看到左下角的位置显示的有Git:master,代表这是一个主分支
例如在主分支中发现了一个必须要修复的BUG,如图
建议一个分支,用以修改BUG
取名为 可以为当前版本号
OK后,IDEA会自动切换到该分支,如果需要切换会主分支,点这里
好啦,该在子分支上修改BUG了
然后Add,在Commit,提交到本地仓库
Push到远程仓库可以看到对应的信息
如果主分支跟子分支都提交到远程仓库,可以在这个地方看到对应的具体分支名称
一般情况下只需要将分支提交到本地仓库,不需要将分支提交远程仓库。如果将所有的分支都提交到远程仓库,会让远程仓库杂乱无章。
合并分支
切换到主分支,进行合并
此时会弹出一个窗口,提示文件冲突
这里选择手动合并
弹出代码合并的对照窗口,分为三部分,左右两侧分别是你和服务器的代码,高亮显示代码不同的部分,带有箭头和叉号,通过点击 “>>” 将两边冲突的代码添加到中间的合并区域中去,点击 “×” 则放弃那一段代码,待所有冲突处理完成后merge就成功了(此段难以表达,故借鉴下别个的,末尾会标明源头)。
合并后
此时可以删除子分支
删除成功后会有提示
5. 查看历史提交记录
右键当前.java文件,找到Git->Show History
6. 与其他版本比较
对单个代码文件的比较,点击文件,右键弹出的菜单选项 → 【Git 】→ 【compare with…】,几个比较方式如下:
Compare with the Same Repository Version 当前文件与服务器同一分支上该文件版本的内容进行比较
Compare with 当前文件与文件各次提交的版本做比较
Compare with Branch 当前文件与其他分支上该文件版本进行比较
与其他版本比较
7. 回退到其他版本
此文借鉴之处:https://blog.csdn.net/kjfdjjvbmc/article/details/92378697
此文借鉴之文借鉴之处:https://www.cnblogs.com/anayigeren/p/10575469.html
今天的文章idea git version control_git提交代码覆盖别人的代码[通俗易懂]分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/87334.html
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图1 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/f5a86c2ca72a4b8c8fbc58c942f7d5a3.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图3 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/936bca7584214a23b008cc0d5d039dd7.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图5 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/090fe0f630f641c5aa0d936e907415fb.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图7 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/417da6328dde44358ba4157ba43a634e.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图9 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/c327349a4ea442db86549d22111bd24e.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图11 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/22307bacd0e94c77bf2a9f6cb5dda54d.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图13 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/c40006b5ac004a56b351117eb1b228c5.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图15 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/7173a6f0095e49b9bad4570fe4382d4a.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图17 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/9921b6de179c4eddba867aee335ce1ce.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图19 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/29eb99895c5e4c89a18bd56fbc8a58a4.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图21 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/bfec785c9bef4b87bc9b5e0be7b1eca9.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图23 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/654f17bede594001abde0e699c15fa43.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图25 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/069d88a15a064b2d8adfa2b42b64af77.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图27 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/ebfd3e22f240489289f7915d3c07634f.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图29 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/26907f9540ae42caa637a6667fa956de.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图31 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/0f325c7c36414e3cbf2131e3703aa3f3.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图33 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/93c5ce5213224dc0b2bffae2441c8445.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图35 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/bedbbff97b9341d6948a0bd4f96a7a33.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图37 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/35d9594964af49db9c46b70f7ee78158.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图39 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/6a556859ec664f0792abb03e5d6da5ff.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图41 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/7f5419edc8b14630a5c481e65e0a04ac.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图43 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/46a47269d63c464a98d78eca526387c6.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图45 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/b5185164e9af4bd5baa399f789e7b040.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图47 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/752475d111184d8d8e4d0d4f5fc8bab4.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图49 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/b4af84f883fa48429bae9d9dd264bc6e.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图51 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/e7d8b5d1b4584ca19444f839f3c30098.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图53 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/29f5021bdeaf476997cf8efae73b0a76.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图55 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/1e79e08596f64d7bb52434b2117e09a7.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图57 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/e185f67e71ab4c92b4b37fc7ee7fc446.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图59 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/b9e31af59d6b4df8a5a68b9cc4c62e7a.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图61 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/9b71cbf1de81478bb64c460b8b339c41.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图63 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/efc4256ead044fbb83c53fb451194433.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图65 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/e8f14b8395ff488b8b717a96fd754854.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图67 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/79605f84c5b94b7e9e1923599ff214b2.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图69 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/27d7da5f8ea845dd9d7df805b9f4f113.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图71 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/f83ec54ab86945e7b5fb6cdc963854f3.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图73 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/5fa5077951c542a5b1bc6f42c56ebbdd.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图75 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/6f6e2cc54b5b4b51ad806d37581e4873.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图77 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/98029ab5869e410d97ac1c9457f51583.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图79 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/ba78c2b267fd47e7b3bc74a396c09f4e.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图81 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/a0f093a9c8574675b344aea6e1c00032.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图83 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/6de54a39af55476a8b3b28938d899383.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图85 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/aca18848021d4472af7e5f77b7a2ebb8.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图87 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/3db29f777d81435fa504682fa817d400.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图89 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/b559c19e44094160b0dc5dafccbab7d0.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图91 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/f07d7a293cb14ece8ec66c8f137e486d.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图93 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/e5c5eb53e1ed49f48e6bf39814a175ef.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图95 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/aed5e0411cd1480c9a2712c82b5872fa.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图97 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/4302410596a146d4920605c6e5132fa0.png)
![idea git version control_git提交代码覆盖别人的代码[通俗易懂]插图99 在这里插入图片描述](https://img.bianchenghao.cn/app/bianchenghao_cn/fa22419cd6ec410e926070006ef8c349.png)