在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快捷入口

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

相关推荐
愿天垂怜1 小时前
【C++脚手架】gtest 单元测试库的介绍与使用
linux·服务器·c++·gitee·前端框架·gtest
像风一样的男人@3 小时前
warning: could not find UI helper ‘git-credential-manager-ui‘
git·ui
代钦塔拉4 小时前
Git & GitHub 从入门到精通:全流程实战教程
git·github
晚风吹红霞5 小时前
Linux下的趣味编程 —— 进度条、Git版本控制与GDB调试实战
linux·运维·git
xlq223226 小时前
7.git
git
Ws_6 小时前
Git + Gerrit 第六课:commit --amend、Patch Set 与 Change-Id
git
是烨笙啊6 小时前
AI编程:项目管理
ide·人工智能·ai编程
czy878747515 小时前
vscode编译make命令要修改stm32cubemx生成的STM32F103XX_FLASH.ld文件
ide·vscode·stm32
AIMath~1 天前
向github中上传文件过大超过50M怎么办
网络·git·github
anthonyzhu1 天前
安卓Android studio panda run无法应用更新的问题
android·ide·android studio