phpstorm git使用
1、配置git
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/8af6ffd1469f4d63.webp)
2、新建项目
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/63f6e4c14940c476.webp)
3、关联远程服务器
开发的时候一般我们会有自己的github服务器(拉取项目代码),测试服务器(部署代码),本地(git),所以我们在修改完代码后,应该先部署到测试服务器上进行测试。这就需要本地与测试服务器之间进行关联。phpstorm里有deploy工具,非常方便,只需简单配置即可。
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/7bd2a69477cc5712.webp)
点击添加
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/9b2dc403118ee309.webp)
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/1e88283f17048eb7.webp)
点击options 配置 ctrl+s自动上传
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/048e48ad1b34cc84.webp)
这样你在本地的任何修改,只需要ctrl+s保存下就会自动上传到远程服务器。
4、git使用
这里主要提供些截图
查看本地的修改 点击version control
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/b444266a371e1f62.webp)
查看git log
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/24229363dd735bfb.webp)
右键查看diff
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/a87136866c77cbbe.webp)
右击项目-> git 这里主要是git的操作
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/cef29cc41e4375a7.webp)
commit提交代码
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/077242e984e41fb7.webp)
其他的操作这里就省略了,了解git的基本操作后,基本上没什么问题。
5、遇到的坑
开发中phpstorm集成git后,使用git pull拉取别人的更新后,发现ctrl+s不自动上传代码至测试服务器。
这里主要是勾选 Upload external changes 。这样你在ctrl+s保存的时候,不论你git pull 拉取了新增文件还是修改的文件,都可以自动上传至服务器了。
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/0901961a239ec89b.webp)
![这里写图片描述](https://jihuo.bianchenghao6.com/uploads/202404/16/afa3fec25b00e20c.webp)
里面有些图是在mac本上截取的,windows上大同小异。找到相应的选项即可。