在IDE中使用Git

我们在开发的时候肯定是经常使用IDE进行开发的,所以在IDE中使用Git也是非常常用的,接下来以IDEA为例,其他的VS code ,Pycharm等IDE都是一样的。

在IDEA中配置Git

1.打开IDEA

2.点击setting

3.直接搜索git 如果已经安装了会自动识别Git,点击test如果失败再手动更改路径

4.打开项目

5.添加一个文件叫做 .gitignore 来控制一些不需要git管理的文件比如.idea等

.gitignore

vbnet 复制代码
### General ###
# OS generated files
.DS_Store
Thumbs.db
ehthumbs.db
Icon?
desktop.ini
*.lnk

# Ignore IntelliJ IDEA project files
.idea/
*.iml

# Ignore build output directories
out/
target/
build/

# Ignore OS-specific files
.DS_Store
Thumbs.db


# Log files
*.log
*.gz
*.out

# Temporary files
*.tmp
*.swp
*.swo

# Backup files
*.bak
*.old
*.orig
*.rej

### IDEs and Editors ###
# IntelliJ IDEA
.idea/
*.iml
*.iws
out/

# Eclipse
.metadata/
*.class
bin/
.tmp/
.factorypath

# NetBeans
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

# VS Code
.vscode/

### Build tools ###
# Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties

# Gradle
.gradle/
/build/
/*.gradle[0-9]?.kts
gradle-app.setting
.gradle-cache/

# Build directories
build/
target/

### Java ###
# Compiled class files
*.class

# Compiled JAR files
*.jar

# Compiled WAR files
*.war

# Compiled EAR files
*.ear

# Generated files
*.log
*.map
hs_err_pid*

# Java-specific files
*.class
*.java~

### Libraries ###
# Package managers
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

### Sensitive or system-specific ###
# Environment variable files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# JetBrains sensitive
container files
  1. 点击vcs新建git repostory,就不再需要init 初始化了

7.然后点击在右上角的对勾填写commit msg然后提交就可以了,提交以后可以在Git log可视化看到提交到内容

8.push 到远端:点击git --> push ---> define remote 输入SSH地址

9.再点击push就可以了

10.gitee查看

修改与克隆

修改

然后对文件修改,修改后的版本再次提交。

点击log查看可以看到提交次数以及记录,同时能够对比出修改的位置。

Clone

1.从远端获取项目的SSH地址

2.点击git ---> clone (可以设置clone的目的目录)

3.IDE 中的push冲突解决 :冲突解决 其实本质还是一样的

分支操作

branch的创建,直接右键提交节点就可以直接new branch

合并branch,点击右下角master 切换或者merge

切换分支直接Checkout就可以了

尝试操作一下吧

IDEA快捷入口

切换分支前先提交本地的修改 代码及时提交,提交过了就不会丢

相关推荐
2501_9159214320 分钟前
从零开始学 Swift iOS 开发 iOS应用入门
ide·vscode·ios·objective-c·个人开发·swift·敏捷流程
Fzuim10 小时前
当 AI 也成为提交者:ThinkFlow 的 Git 提交规范,是怎么定的
git·agent·thinkflow
null_1717 小时前
IntelliJ IDEA 极致流畅配置方案:Ultra 9 285K + 64GB 内存实测
java·ide·intellij-idea
爱吃提升18 小时前
VSCode 配置 Claude + Codex 完整教程
ide·vscode·编辑器
CodexDave1 天前
数据库连接池耗尽:排查顺序与三层兜底
服务器·前端·数据库·git·云原生·容器·kubernetes
云泽8081 天前
VSCode入门指南:从认识、安装到语言插件配置全解析
ide·vscode·编辑器
乐观的Terry1 天前
5、发布系统-Git 集成
大数据·git·elasticsearch
不怕犯错,就怕不做1 天前
GIT的简单打patch应用format-patch and git am
linux·git·全文检索
m0_617493941 天前
PyCharm 新手避坑指南:一文解决“项目列表消失”与“模块导入报错”两大玄学问题
ide·python·pycharm
Byron Loong1 天前
【Git】如何检查 Ubuntu 系统上 gitLab 是否开启
git·ubuntu·gitlab